Skip to content

Commit 97b6eeb

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

File tree

2 files changed

+56
-101
lines changed

2 files changed

+56
-101
lines changed

.github/workflows/build.yml

+56-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,64 @@ 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: |
61+
sudo apt install ninja
62+
poetry install --with github-actions,test
63+
64+
- name: Run pytest
65+
env:
66+
POETRY_TEST_INTEGRATION_GIT_USERNAME: ${GITHUB_ACTOR}
67+
POETRY_TEST_INTEGRATION_GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
68+
run: poetry run pytest -v
69+
70+
# --- Build
2371

2472
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v2
73+
uses: docker/setup-qemu-action@v3
2674

2775
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v2
76+
uses: docker/setup-buildx-action@v3
2977

3078
- name: Login to GitHub Container Registry
31-
uses: docker/login-action@v2
79+
uses: docker/login-action@v3
3280
with:
3381
registry: ghcr.io
3482
username: ${{ github.repository_owner }}
@@ -41,7 +89,7 @@ jobs:
4189
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
4290
4391
- name: Build and push (Nightly)
44-
uses: docker/build-push-action@v4
92+
uses: docker/build-push-action@v6
4593
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'dev' && github.repository == 'ziro-bot/z3r0' }}
4694
with:
4795
context: .
@@ -50,7 +98,7 @@ jobs:
5098
tags: ghcr.io/ziro-bot/z3r0:nightly
5199

52100
- name: Build and push (Canary)
53-
uses: docker/build-push-action@v4
101+
uses: docker/build-push-action@v6
54102
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'overhaul' && github.repository == 'ziro-bot/z3r0' }}
55103
with:
56104
context: .
@@ -59,7 +107,7 @@ jobs:
59107
tags: ghcr.io/ziro-bot/z3r0:canary
60108

61109
- name: Build and push (Release)
62-
uses: docker/build-push-action@v4
110+
uses: docker/build-push-action@v6
63111
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ziro-bot/z3r0'
64112
with:
65113
context: .

.github/workflows/test.yml

-93
This file was deleted.

0 commit comments

Comments
 (0)