-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (61 loc) · 2.03 KB
/
continuous-integration.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Github Action Continuous Integration (CI) pipeline
on:
- push
jobs:
python-code-checks:
strategy:
fail-fast: false
matrix:
include:
- check-name: ruff
check-command: ruff check --format github .
- check-name: black
check-command: black --check .
# TODO: configure mypy cache
- check-name: mypy
check-command: mypy
name: ${{ matrix.check-name }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: pip install poetry==1.5.0
- uses: actions/setup-python@v4
with:
python-version-file: ".python-version"
cache: 'poetry'
- run: poetry install --with dev
- run: poetry run ${{ matrix.check-command }}
docker:
runs-on: ubuntu-22.04
needs:
- python-code-checks
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- if: github.ref_name == github.event.repository.default_branch
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v4
with:
push: ${{ github.ref_name == github.event.repository.default_branch }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
# TODO: build other targets?
target: api
# NOTE: see https://docs.docker.com/build/cache/backends/gha/#scope
cache-from: |
type=gha,scope=${{ github.ref_name }}
type=gha,scope=${{ github.base_ref }}
type=gha,scope=${{ github.event.repository.default_branch }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}