Skip to content

Commit 1e7b8e2

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

File tree

2 files changed

+55
-101
lines changed

2 files changed

+55
-101
lines changed

.github/workflows/build.yml

+55-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,63 @@ jobs:
1919

2020
steps:
2121
- 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
2370

2471
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v2
72+
uses: docker/setup-qemu-action@v3
2673

2774
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v2
75+
uses: docker/setup-buildx-action@v3
2976

3077
- name: Login to GitHub Container Registry
31-
uses: docker/login-action@v2
78+
uses: docker/login-action@v3
3279
with:
3380
registry: ghcr.io
3481
username: ${{ github.repository_owner }}
@@ -41,7 +88,7 @@ jobs:
4188
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
4289
4390
- name: Build and push (Nightly)
44-
uses: docker/build-push-action@v4
91+
uses: docker/build-push-action@v6
4592
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'dev' && github.repository == 'ziro-bot/z3r0' }}
4693
with:
4794
context: .
@@ -50,7 +97,7 @@ jobs:
5097
tags: ghcr.io/ziro-bot/z3r0:nightly
5198

5299
- name: Build and push (Canary)
53-
uses: docker/build-push-action@v4
100+
uses: docker/build-push-action@v6
54101
if: ${{ !startsWith(github.ref, 'refs/tags/') && github.ref_name == 'overhaul' && github.repository == 'ziro-bot/z3r0' }}
55102
with:
56103
context: .
@@ -59,7 +106,7 @@ jobs:
59106
tags: ghcr.io/ziro-bot/z3r0:canary
60107

61108
- name: Build and push (Release)
62-
uses: docker/build-push-action@v4
109+
uses: docker/build-push-action@v6
63110
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'ziro-bot/z3r0'
64111
with:
65112
context: .

.github/workflows/test.yml

-93
This file was deleted.

0 commit comments

Comments
 (0)