1
- name : Build
1
+ name : Build and Test
2
2
3
3
on :
4
4
push :
@@ -19,16 +19,63 @@ jobs:
19
19
20
20
steps :
21
21
- name : Checkout
22
- uses : actions/checkout@v3
22
+ uses : actions/checkout@v4
23
+
24
+ - name : Set up Python 3.11
25
+ uses : actions/setup-python@v5
26
+ with :
27
+ python-version : 3.11
28
+
29
+ - name : Get full Python version
30
+ id : full-python-version
31
+ run : echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
32
+
33
+ - name : Bootstrap poetry
34
+ run : |
35
+ curl -sSL https://install.python-poetry.org | python - -y
36
+
37
+ - name : Configure poetry
38
+ run : poetry config virtualenvs.in-project true
39
+
40
+ - name : Set up cache
41
+ uses : actions/cache@v4
42
+ id : cache
43
+ with :
44
+ path : .venv
45
+ key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
46
+
47
+ - name : Ensure cache is healthy
48
+ if : steps.cache.outputs.cache-hit == 'true'
49
+ run : |
50
+ # `timeout` is not available on macOS, so we define a custom function.
51
+ [ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
52
+
53
+ # Using `timeout` is a safeguard against the Poetry command hanging for some reason.
54
+ timeout 10s poetry run pip --version || rm -rf .venv
55
+
56
+ - name : Check lock file
57
+ run : poetry lock --check
58
+
59
+ - name : Install dependencies
60
+ run : |
61
+ poetry install --with github-actions,test
62
+
63
+ - name : Run pytest
64
+ env :
65
+ POETRY_TEST_INTEGRATION_GIT_USERNAME : ${GITHUB_ACTOR}
66
+ POETRY_TEST_INTEGRATION_GIT_PASSWORD : ${{ secrets.GITHUB_TOKEN }}
67
+ run : poetry run pytest -v
68
+
69
+ # --- Build
23
70
24
71
- name : Set up QEMU
25
- uses : docker/setup-qemu-action@v2
72
+ uses : docker/setup-qemu-action@v3
26
73
27
74
- name : Set up Docker Buildx
28
- uses : docker/setup-buildx-action@v2
75
+ uses : docker/setup-buildx-action@v3
29
76
30
77
- name : Login to GitHub Container Registry
31
- uses : docker/login-action@v2
78
+ uses : docker/login-action@v3
32
79
with :
33
80
registry : ghcr.io
34
81
username : ${{ github.repository_owner }}
41
88
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
42
89
43
90
- name : Build and push (Nightly)
44
- uses : docker/build-push-action@v4
91
+ uses : docker/build-push-action@v6
45
92
if : ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'dev' && github.repository == 'ziro-bot/z3r0' }}
46
93
with :
47
94
context : .
50
97
tags : ghcr.io/ziro-bot/z3r0:nightly
51
98
52
99
- name : Build and push (Canary)
53
- uses : docker/build-push-action@v4
100
+ uses : docker/build-push-action@v6
54
101
if : ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'overhaul' && github.repository == 'ziro-bot/z3r0' }}
55
102
with :
56
103
context : .
59
106
tags : ghcr.io/ziro-bot/z3r0:canary
60
107
61
108
- name : Build and push (Release)
62
- uses : docker/build-push-action@v4
109
+ uses : docker/build-push-action@v6
63
110
if : startsWith(github.ref, 'refs/tags/') && github.repository == 'ziro-bot/z3r0'
64
111
with :
65
112
context : .
0 commit comments