Skip to content

Commit 4e5f1a6

Browse files
committed
Replace lint-and-test with ci.yml
This is shorter and runs on every commit pushed, so it can run on branches before they get PRed, irrespective if they're into `main` or not. The coverage task only runs on the main branch.
1 parent 5393bc6 commit 4e5f1a6

File tree

2 files changed

+72
-94
lines changed

2 files changed

+72
-94
lines changed

.github/workflows/ci.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
gitleaks:
7+
name: Gitleaks
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v5
11+
with:
12+
fetch-depth: 0 # Full history is needed to scan all commits
13+
- uses: jdx/mise-action@v3
14+
with:
15+
cache: true
16+
- run: gitleaks detect --verbose --redact
17+
18+
pytest:
19+
name: Pytest
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v5
23+
- uses: jdx/mise-action@v3
24+
with:
25+
cache: true
26+
- env:
27+
SECRET_KEY: "${{ secrets.SECRET_KEY_FOR_TESTS }}"
28+
run: make test
29+
30+
ruff:
31+
name: Ruff
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v5
35+
- uses: jdx/mise-action@v3
36+
with:
37+
cache: true
38+
- run: make lint
39+
40+
coverage:
41+
name: Coverage
42+
needs: [pytest]
43+
runs-on: ubuntu-latest
44+
if: github.ref == 'refs/heads/main'
45+
outputs:
46+
badge_url: ${{ steps.upload-coverage-badge-artifact-step.outputs.artifact-url }}
47+
html_report_url: ${{ steps.upload-html-report-artifact-step.outputs.artifact-url }}
48+
steps:
49+
- uses: actions/checkout@v5
50+
- uses: jdx/mise-action@v3
51+
with:
52+
cache: true
53+
- env:
54+
SECRET_KEY: "${{ secrets.SECRET_KEY_FOR_TESTS }}"
55+
COVERAGE_THRESHOLD: 80
56+
run: make test-coverage
57+
- uses: actions/upload-artifact@v4
58+
id: upload-html-report-artifact-step
59+
if: always()
60+
with:
61+
name: coverage-html
62+
path: htmlcov
63+
retention-days: 10
64+
compression-level: 0
65+
- uses: actions/upload-artifact@v4
66+
id: upload-coverage-badge-artifact-step
67+
if: always()
68+
with:
69+
name: coverage-badge
70+
path: coverage.svg
71+
retention-days: 10
72+
compression-level: 0

.github/workflows/lint-and-test.yaml

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

0 commit comments

Comments
 (0)