8000 workflows/ci: do some job optimization · tetsuo-cpp/sigstore-python@0ed738b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ed738b

Browse files
committed
workflows/ci: do some job optimization
Signed-off-by: William Woodruff <william@trailofbits.com>
1 parent b94929c commit 0ed738b

File tree

1 file changed

+45
-33
lines changed

1 file changed

+45
-33
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,49 @@ on:
99
- cron: '0 12 * * *'
1010

1111
jobs:
12+
licenses:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
16+
17+
# adapted from Warehouse's bin/licenses
18+
- run: |
19+
for fn in $(find . -type f -name "*.py"); do
20+
if [[ ! "$(head -5 $fn | grep "^ *\(#\|\*\|\/\/\) .* License\(d*\)")" ]]; then
21+
echo "${fn} is missing a license"
22+
exit 1
23+
fi
24+
done
25+
26+
lint:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
30+
31+
- uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a
32+
33+
- name: deps
34+
run: make dev SIGSTORE_EXTRA=lint
35+
36+
- name: lint
37+
run: make lint
38+
39+
check-readme:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
43+
44+
- uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a
45+
46+
- name: deps
47+
run: make dev
48+
49+
- name: check-readme
50+
run: make check-readme
51+
1252
test:
53+
# We don't bother running the tests unless the basic lints pass.
54+
needs: [licenses, lint, check-readme]
1355
permissions:
1456
# Needed to access the workflow's OIDC identity.
1557
id-token: write
@@ -38,6 +80,9 @@ jobs:
3880
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v2.1.0
3981

4082
test-offline:
83+
# We don't bother running the offline tests unless the normal tests pass,
84+
# since they're a strict subset.
85+
needs: [test]
4186
strategy:
4287
matrix:
4388
python:
@@ -64,36 +109,3 @@ jobs:
64109
# "online-only" test markers, since any test that's online
65110
# but not marked as such will fail.
66111
unshare --map-root-user --net make test TEST_ARGS="--skip-online"
67-
68-
licenses:
69-
runs-on: ubuntu-latest
70-
steps:
71-
- uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
72-
# adapted from Warehouse's bin/licenses
73-
- run: |
74-
for fn in $(find . -type f -name "*.py"); do
75-
if [[ ! "$(head -5 $fn | grep "^ *\(#\|\*\|\/\/\) .* License\(d*\)")" ]]; then
76-
echo "${fn} is missing a license"
77-
exit 1
78-
fi
79-
done
80-
81-
lint:
82-
runs-on: ubuntu-latest
83-
steps:
84-
- uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
85-
- uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a
86-
- name: deps
87-
run: make dev SIGSTORE_EXTRA=lint
88-
- name: lint
89-
run: make lint
90-
91-
check-readme:
92-
runs-on: ubuntu-latest
93-
steps:
94-
- uses: actions/checkout@d171c3b028d844f2bf14e9fdec0c58114451e4bf
95-
- uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a
96-
- name: deps
97-
run: make dev
98-
- name: check-readme
99-
run: make check-readme

0 commit comments

Comments
 (0)
0