-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.44 KB
/
ci.yml
File metadata and controls
48 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set-up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'poetry'
check-latest: true
- name: Install dependencies
run: poetry install
- name: Check formatting and linting
run: poetry run ruff check .
- name: Run static type checking
run: poetry run mypy containerized_microservice tests
- name: Run Tests
run: poetry run pytest
- name: Build Python app
run: poetry build
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push container to Docker Hub
run: |
docker build \
--build-arg="APP_VERSION=$(poetry version -s)" \
-t ${{ secrets.DOCKERHUB_USERNAME }}/containerized-microservice:$(poetry version -s) \
-t ${{ secrets.DOCKERHUB_USERNAME }}/containerized-microservice:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/containerized-microservice -a