Skip to content

Commit ebebf4b

Browse files
committed
add docker image GH workflow
1 parent 8293ecc commit ebebf4b

File tree

3 files changed

+83
-32
lines changed

3 files changed

+83
-32
lines changed

.github/workflows/cicd.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Tests
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
ruff:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: astral-sh/ruff-action@v3
10+
11+
tests:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.13"]
16+
os: [ubuntu-24.04, macos-latest, windows-latest]
17+
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
enable-cache: true
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install the project
29+
run: uv sync --all-extras --dev
30+
31+
- name: Run tests
32+
run: uv run pytest
33+
34+
docker:
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
os: [ubuntu-24.04, ubuntu-24.04-arm]
39+
40+
permissions:
41+
contents: read
42+
packages: write
43+
attestations: write
44+
id-token: write
45+
46+
runs-on: ${{ matrix.os }}
47+
needs: [ ruff, tests ]
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
52+
- name: Log in to the Container registry
53+
uses: docker/login-action@v3
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Extract metadata (tags, labels) for Docker
60+
id: meta
61+
uses: docker/metadata-action@v5
62+
with:
63+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Build and push Docker image
69+
id: push
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: .
73+
push: true
74+
provenance: false
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
78+
- name: Generate artifact attestation
79+
uses: actions/attest-build-provenance@v2
80+
with:
81+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
82+
subject-digest: ${{ steps.push.outputs.digest }}
83+
push-to-registry: true
File renamed without changes.

.github/workflows/tests.yml

-32
This file was deleted.

0 commit comments

Comments
 (0)