Skip to content

Commit e914ec8

Browse files
committed
ci: Update actions and merge test with build
1 parent 1e4d6fb commit e914ec8

File tree

2 files changed

+54
-101
lines changed

2 files changed

+54
-101
lines changed

.github/workflows/build.yml

+54-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Build and Test
22

33
on:
44
push:
@@ -19,16 +19,62 @@ jobs:
1919

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python 3.12
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: 3.12
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: poetry install --with github-actions,test
61+
62+
- name: Run pytest
63+
env:
64+
POETRY_TEST_INTEGRATION_GIT_USERNAME: ${GITHUB_ACTOR}
65+
POETRY_TEST_INTEGRATION_GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
66+
run: poetry run pytest -v
67+
68+
# --- Build
2369

2470
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v2
71+
uses: docker/setup-qemu-action@v3
2672

2773
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v2
74+
uses: docker/setup-buildx-action@v3
2975

3076
- name: Login to GitHub Container Registry
31-
uses: docker/login-action@v2
77+
uses: docker/login-action@v3
3278
with:
3379
registry: ghcr.io
3480
username: ${{ github.repository_owner }}
@@ -41,7 +87,7 @@ jobs:
4187
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
4288
4389
- name: Build and push (Nightly)
44-
uses: docker/build-push-action@v4
90+
uses: docker/build-push-action@v6
4591
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'dev' && github.repository == 'ziro-bot/z3r0' }}
4692
with:
4793
context: .
@@ -50,7 +96,7 @@ jobs:
5096
tags: ghcr.io/ziro-bot/z3r0:nightly
5197

5298
- name: Build and push (Canary)
53-
uses: docker/build-push-action@v4
99+
uses: docker/build-push-action@v6
54100
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'overhaul' && github.repository == 'ziro-bot/z3r0' }}
55101
with:
56102
context: .
@@ -59,7 +105,7 @@ jobs:
59105
tags: ghcr.io/ziro-bot/z3r0:canary
60106

61107
- name: Build and push (Release)
62-
uses: docker/build-push-action@v4
108+
uses: docker/build-push-action@v6
63109
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ziro-bot/z3r0'
64110
with:
65111
context: .

.github/workflows/test.yml

-93
This file was deleted.

0 commit comments

Comments
 (0)