Skip to content

Commit 23a66dc

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

File tree

5 files changed

+116
-33
lines changed

5 files changed

+116
-33
lines changed

.github/workflows/cicd.yml

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

.github/workflows/tests.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ cli = [
1717
dev = [
1818
"bump-my-version>=1.0.1",
1919
"pytest>=8.3.5",
20+
"ruff>=0.9.9",
2021
]

uv.lock

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)