Repository navigation
204 lines (192 loc) · 6.36 KB
/
Copy pathci.yaml
File metadata and controls
204 lines (192 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: CI
# Reusable test suite. Call from pull_request.yaml / release.yaml — do not trigger directly.
on:
workflow_call:
permissions: {}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Run Ruff Lint
run: uv run ruff check
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Run Ty for typechecking
run: uv run ty check
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Run Ruff Format Check
run: uv run ruff format --check
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Run sphinx-build
run: uv run sphinx-build docs docs/_build
unit-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version:
- "3.12"
- "3.13"
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Run Unittests
run: uv run pytest --ignore tests/integration .
# Cargo / Rust stuff
cargo-fmt:
name: "cargo fmt"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: "Install Rust toolchain"
run: rustup component add rustfmt
- run: cargo fmt --all --check
cargo-clippy:
name: "cargo clippy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Install Rust toolchain"
run: rustup component add clippy
- name: "Clippy"
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo-test-linux:
name: "cargo test (linux)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Install Rust toolchain"
run: rustup show
- name: "Run tests"
run: cargo test
# integration / self packaging tests
package_ourself:
runs-on: ubuntu-latest
permissions:
contents: read
# Push of the pre-built CI image is additionally gated to main below.
packages: write
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Resolve CI image tag
id: image
run: |
codename="$(dpkg-parsechangelog -SDistribution)"
key="$(cat debian/control .github/ci/Dockerfile.build-deps | sha256sum | cut -c1-12)-$(date -u +%G-W%V)"
echo "tag=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/debmagic-ci:${codename}-${key}" >> "$GITHUB_OUTPUT"
echo "codename=${codename}" >> "$GITHUB_OUTPUT"
- name: Pull or build the CI image
run: |
if ! docker pull "${{ steps.image.outputs.tag }}"; then
docker build \
--build-arg "BASE_IMAGE=docker.io/debian:${{ steps.image.outputs.codename }}" \
--tag "${{ steps.image.outputs.tag }}" \
--file .github/ci/Dockerfile.build-deps \
.
echo "image_built=true" >> "$GITHUB_ENV"
fi
- name: Run Debmagic build on ourself
run: |
cargo run --locked -p debmagic -- build binary \
--driver=docker \
--driver-docker-base-image="${{ steps.image.outputs.tag }}" \
--sign=no
- name: Run Debmagic test on ourself
run: |
cargo run --locked -p debmagic -- test \
--driver=docker \
--driver-docker-base-image="${{ steps.image.outputs.tag }}"
- name: Push the CI image
if: github.ref == 'refs/heads/main' && env.image_built == 'true'
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username "${{ github.actor }}" --password-stdin
docker push "${{ steps.image.outputs.tag }}"
# TODO: integration tests currently don't work in the CI since they require running apt source on debian trixie -> CI runs on ubuntu
# integration-tests:
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# python-version:
# - "3.12"
# os: [ubuntu-latest]
# steps:
# - uses: actions/checkout@v5
# - name: Set up Python
# uses: actions/setup-python@v6
# with:
# python-version: "3.12"
# - name: Install uv
# uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9
# with:
# enable-cache: true
# - name: Install the project
# run: uv sync --locked --all-extras --dev
# - name: Run Integrationtests
# run: uv run pytest tests/integration