Repository navigation
87 lines (71 loc) · 1.86 KB
/
Copy pathpython-ci.yml
File metadata and controls
87 lines (71 loc) · 1.86 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CI
on:
push:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.meta.outputs.image-tag }}
steps:
- uses: actions/checkout@v7
- name: Set image tag
id: meta
run: echo "image-tag=test-image" >> $GITHUB_OUTPUT
- name: Build Docker image
run: docker build -t test-image .
- name: Save Docker image to tarball
run: |
mkdir -p image-cache
docker save -o image-cache/test-image.tar test-image
- name: Cache Docker image
uses: actions/cache@v6
with:
path: image-cache/test-image.tar
key: test-image-${{ hashFiles('Dockerfile', 'pyproject.toml', 'uv.lock') }}
mypy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/load-cached-docker-image
with:
image-name: test-image
- name: Run mypy
run: |
docker run --rm \
-v ${{ github.workspace }}:/app \
-w /app \
test-image \
mypy .
ruff:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/load-cached-docker-image
with:
image-name: test-image
- name: Run ruff
run: |
docker run --rm \
-v ${{ github.workspace }}:/app \
-w /app \
test-image \
ruff check
tests:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/load-cached-docker-image
with:
image-name: test-image
- name: Run pytest
run: |
docker run --rm \
-v ${{ github.workspace }}:/app \
-w /app \
test-image \
pytest