Skip to content

Commit 4ea31cb

Browse files
authored
Migrate to uv and gha (#223)
BREAKING CHANGES
1 parent a2d79e5 commit 4ea31cb

24 files changed

+3814
-2284
lines changed

.circleci/config.yml

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

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,6 @@ cython_debug/
161161
.idea/
162162

163163
.git
164+
165+
### Node.js template
166+
node_modules/

.github/workflows/docker.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Docker
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
merge_group:
7+
schedule:
8+
- cron: "0 0 * * *"
9+
push:
10+
branches: [ "main" ]
11+
release:
12+
types: [ published ]
13+
14+
permissions: read-all
15+
16+
jobs:
17+
lint:
18+
name: Lint Dockerfile
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
- uses: hadolint/hadolint-action@2332a7b74a6de0dda2e2221d575162eba76ba5e5 # v3.3.0
23+
24+
build:
25+
name: Build and publish
26+
runs-on: ubuntu-24.04-arm
27+
permissions:
28+
contents: read
29+
packages: write
30+
attestations: write
31+
id-token: write
32+
security-events: write
33+
steps:
34+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
35+
- uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ github.token }}
40+
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
41+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
42+
- uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
43+
id: meta
44+
env:
45+
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
46+
with:
47+
images: ghcr.io/${{ github.repository }}
48+
tags: |
49+
type=schedule
50+
type=semver,pattern={{raw}}
51+
type=semver,pattern=v{{major}}.{{minor}}
52+
type=semver,pattern=v{{major}}
53+
type=ref,event=branch
54+
type=ref,event=pr
55+
# on.schedule: nightly
56+
# on.push:tag: latest (auto), v1.2.3, v.1,2, v.1
57+
# on.push.branch: branchName
58+
# on.pull_request: pr-number (won't be pushed)
59+
60+
- uses: docker/bake-action@3acf805d94d93a86cce4ca44798a76464a75b88c # v6.9.0
61+
with:
62+
push: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
63+
files: |
64+
cwd://${{ steps.meta.outputs.bake-file }}
65+
cwd://${{ steps.meta.outputs.bake-file-annotations }}
66+
./docker-bake.hcl
67+
sbom: true
68+
provenance: true
69+
set: |
70+
*.cache-from=type=gha
71+
*.cache-to=type=gha,mode=max
72+
73+
- uses: anchore/scan-action@568b89d27fc18c60e56937bff480c91c772cd993 # v7.1.0
74+
id: scan
75+
if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
76+
with:
77+
image: "ghcr.io/bsstudio/bss-web-file-api:${{ env.DOCKER_METADATA_OUTPUT_VERSION }}"
78+
cache-db: true
79+
severity-cutoff: 'high'
80+
fail-build: false
81+
82+
- uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
83+
if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
84+
with:
85+
sarif_file: ${{ steps.scan.outputs.sarif }}

.github/workflows/integration.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Integration test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
merge_group:
7+
push:
8+
branches: [ "main" ]
9+
10+
permissions: read-all
11+
12+
jobs:
13+
unit-test:
14+
name: Integration test
15+
runs-on: ubuntu-22.04
16+
timeout-minutes: 5
17+
permissions:
18+
id-token: write
19+
steps:
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
21+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
22+
with:
23+
python-version-file: "pyproject.toml"
24+
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
25+
- run: uv run pytest tests-int

.github/workflows/python.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Python
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
merge_group:
7+
push:
8+
branches: [ "main" ]
9+
10+
permissions: read-all
11+
12+
jobs:
13+
pre-commit:
14+
name: Pre commit checks
15+
runs-on: ubuntu-22.04
16+
timeout-minutes: 5
17+
steps:
18+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
20+
with:
21+
python-version-file: "pyproject.toml"
22+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
23+
24+
unit-test:
25+
name: Unit test
26+
runs-on: ubuntu-22.04
27+
timeout-minutes: 5
28+
permissions:
29+
id-token: write
30+
steps:
31+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
32+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
33+
with:
34+
python-version-file: "pyproject.toml"
35+
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
36+
- run: uv run pytest tests --cov=src --cov-fail-under=100 --cov-report json
37+
- uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 #v5.5.1
38+
with:
39+
use_oidc: true
40+
41+
type-test:
42+
name: Static type check
43+
runs-on: ubuntu-22.04
44+
timeout-minutes: 5
45+
steps:
46+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
47+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
48+
with:
49+
python-version-file: "pyproject.toml"
50+
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
51+
- run: uv run mypy
52+
- run: uv run pylint src
53+
54+
lint:
55+
name: Lint
56+
runs-on: ubuntu-22.04
57+
timeout-minutes: 5
58+
steps:
59+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
60+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
61+
with:
62+
python-version-file: "pyproject.toml"
63+
- uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
64+
- run: uv run black --check .
65+
- run: uv run isort --check .

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
push:
7+
branches: [ main ]
8+
9+
permissions: read-all
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
17+
id: release-token
18+
with:
19+
app-id: ${{ vars.RELEASE_APP_ID }}
20+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
21+
permission-contents: write # to be able to publish a GitHub release
22+
permission-issues: write # to be able to comment on released issues
23+
permission-pull-requests: write # to be able to comment on released pull requests
24+
25+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
with:
27+
token: ${{ steps.release-token.outputs.token }}
28+
fetch-depth: 0
29+
30+
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
31+
32+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
33+
with:
34+
node-version-file: package.json
35+
cache: 'pnpm'
36+
cache-dependency-path: 'pnpm-lock.yaml'
37+
38+
- run: pnpm install
39+
40+
- run: pnpm run release
41+
env:
42+
GH_TOKEN: ${{ steps.release-token.outputs.token }}

0 commit comments

Comments
 (0)