Skip to content

Commit 09319b9

Browse files
authored
miscellaneous maintenance (mostly GHA) (#214)
- add zizmor GHA linter job. - add ruff to GHA linter job. - set `persist-credentials: false`. - drop permissions where missing. - set GHA concurrency where missing. - suppress zizmor warning for `cancel-in-progress: false`. Though perhaps it could be set to `true`? - pages: replace hard-coded string with GitHub variable. - sync action version numbers in comments. - use full version numbers in newly added actions. - page: scope extra permissions to the deploy job. - silence zizmor warning about unpinned oss-fuzz action. - avoid GitHub macros in shell code. Replace by envs. - add name to each job to make them easier to read, and to silence pedantic zizmor. - say why a job needs extra permissions. For zizmor. - shell: add missing double quotes, drop unused variables, fix printf format string to be constant, fix other misc shellcheck warnings. - move 'just_dependencies', 'PythonTests', 'Mainline' (2x) jobs from `ci` to a new `local` workflow, to not get triggered by curl/curl PR and master commits. These jobs either do not use the curl source repo, or use its master branch. To save 5 minutes CI time per curl/curl PR push. - test_corpus_decoder.py: fix to indent consistently. - fix issues reported by yamllint. (indent mostly) - sync ruff configuration with other curl repos. Fix minor fallouts. Credits-to: Dan Fandrich curl/curl@57cc523 - make sure to always use `pyproject.toml` to install pip packages. To have all of them pinned. - move `pyproject.toml` default packages to group to avoid installing them when unused. - merge two pip invocations by adding a pinned `pytest_playwright` to the group. - drop `pip` upgrades, use the version preinstalled on the host, for determinism. - tidy-up python shebangs and exec attributes. - tidy-up shell script shebangs and sets. - delete copyright years. - drop step name from well-known actions like checkout and python, to sync with other curl repos and making it more readily apparent what they are. - pyproject.toml: use a single style to specify dependency versions. - cmake: drop redundant `DEFINED ENV` checks. - cmake: drop appending `CFLAGS`, `CXXFLAGS` envs manually. CMake uses these automatically. https://cmake.org/cmake/help/latest/envvar/CFLAGS.html https://cmake.org/cmake/help/latest/envvar/CXXFLAGS.html - cmake: check if empty is non-empty, vs. just defined. - cmake: fold long lines. - whitespace.
1 parent 5280aaf commit 09319b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+568
-477
lines changed

.github/workflows/build.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build
2+
3+
'on':
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
16+
17+
jobs:
18+
Mainline:
19+
name: 'Mainline'
20+
strategy:
21+
matrix:
22+
sanitizer:
23+
- address
24+
- memory
25+
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
29+
with:
30+
persist-credentials: false
31+
32+
- name: Install Dependencies
33+
run: |
34+
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
35+
sudo apt-get -o Dpkg::Use-Pty=0 update
36+
sudo rm -f /var/lib/man-db/auto-update
37+
sudo apt-get -o Dpkg::Use-Pty=0 install -y cmake clang ninja-build
38+
39+
- name: Compile mainline
40+
env:
41+
SANITIZER: '${{ matrix.sanitizer }}' # test with different "sanitizers"
42+
run: ./mainline.sh
43+
44+
just_dependencies:
45+
name: 'Just dependencies'
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
49+
with:
50+
persist-credentials: false
51+
52+
- name: Install Dependencies
53+
run: |
54+
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
55+
sudo apt-get -o Dpkg::Use-Pty=0 update
56+
sudo rm -f /var/lib/man-db/auto-update
57+
sudo apt-get -o Dpkg::Use-Pty=0 install -y cmake clang ninja-build
58+
59+
- name: Compile deps target
60+
run: ./scripts/compile_target.sh deps
61+
62+
PythonTests:
63+
name: 'Python tests'
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
67+
with:
68+
persist-credentials: false
69+
70+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
71+
with:
72+
python-version: '3.12'
73+
74+
- name: Install test dependencies
75+
run: pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary '.[python-tests]'
76+
77+
- name: Run TLV constants sync test
78+
run: pytest tests/test_tlv_constants_sync.py

.github/workflows/checksrc.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright (C) Daniel Stenberg, <[email protected]>, et al.
2+
#
3+
# SPDX-License-Identifier: curl
4+
5+
name: 'Source'
6+
7+
'on':
8+
push:
9+
branches:
10+
- master
11+
pull_request:
12+
branches:
13+
- master
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
permissions: {}
20+
21+
jobs:
22+
linters:
23+
name: 'linters'
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
with:
28+
persist-credentials: false
29+
30+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
31+
with:
32+
python-version: '3.12'
33+
34+
- name: 'install prereqs'
35+
run: |
36+
/home/linuxbrew/.linuxbrew/bin/brew install zizmor
37+
pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary '.[ci-tests]'
38+
39+
- name: 'zizmor GHA'
40+
env:
41+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
42+
run: |
43+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
44+
zizmor --pedantic .github/workflows/*.yml
45+
46+
- name: 'ruff'
47+
run: |
48+
ruff --version
49+
# shellcheck disable=SC2046
50+
ruff check $(git ls-files '*.py')

.github/workflows/ci.yml

Lines changed: 39 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# Workflow used by curl/curl
2+
13
name: CI
4+
25
'on':
36
push:
47
branches:
@@ -20,14 +23,16 @@ permissions: {}
2023

2124
jobs:
2225
DetermineMatrix:
26+
name: 'Determine matrix'
2327
runs-on: ubuntu-latest
2428
outputs:
2529
matrix: ${{ steps.set-matrix.outputs.matrix }}
2630
steps:
27-
- name: Checkout
28-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2932
with:
33+
persist-credentials: false
3034
repository: curl/curl-fuzzer
35+
3136
- name: Set matrix
3237
id: set-matrix
3338
run: |
@@ -36,29 +41,31 @@ jobs:
3641
python3 -m generate_matrix | tee $GITHUB_OUTPUT
3742
3843
BuildFuzzers:
44+
name: 'Build fuzzers'
3945
runs-on: ubuntu-latest
4046
steps:
41-
# Use the CIFuzz job to test the repository.
42-
- name: Build Fuzzers
43-
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
44-
with:
45-
oss-fuzz-project-name: 'curl'
46-
dry-run: false
47-
keep-unaffected-fuzz-targets: true
47+
# Use the CIFuzz job to test the repository.
48+
- name: Build Fuzzers
49+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master # zizmor: ignore[unpinned-uses]
50+
with:
51+
oss-fuzz-project-name: 'curl'
52+
dry-run: false
53+
keep-unaffected-fuzz-targets: true
4854

49-
# Archive the fuzzer output (which maintains permissions)
50-
- name: Create fuzz tar
51-
run: tar cvf fuzz.tar build-out/
55+
# Archive the fuzzer output (which maintains permissions)
56+
- name: Create fuzz tar
57+
run: tar cvf fuzz.tar build-out/
5258

53-
# Upload the fuzzer output
54-
- name: Archive fuzz tar
55-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
56-
with:
57-
name: fuzz_tar
58-
path: fuzz.tar
59+
# Upload the fuzzer output
60+
- name: Archive fuzz tar
61+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
62+
with:
63+
name: fuzz_tar
64+
path: fuzz.tar
5965

6066
RunFuzzers:
61-
needs: [ BuildFuzzers, DetermineMatrix ]
67+
name: 'Run fuzzers'
68+
needs: [BuildFuzzers, DetermineMatrix]
6269
runs-on: ubuntu-latest
6370
strategy:
6471
matrix: ${{ fromJSON(needs.DetermineMatrix.outputs.matrix) }}
@@ -67,89 +74,33 @@ jobs:
6774
with:
6875
name: fuzz_tar
6976
- name: Unpack fuzzer ${{ matrix.fuzzer }}
70-
run: tar xvf fuzz.tar build-out/${{ matrix.fuzzer }} build-out/${{ matrix.fuzzer }}_seed_corpus.zip
77+
env:
78+
MATRIX_FUZZER: '${{ matrix.fuzzer }}'
79+
run: tar xvf fuzz.tar build-out/"${MATRIX_FUZZER}" build-out/"${MATRIX_FUZZER}"_seed_corpus.zip
7180
- name: Display extracted files
7281
run: ls -laR build-out/
7382
- name: Run Fuzzer ${{ matrix.fuzzer }}
74-
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
83+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master # zizmor: ignore[unpinned-uses]
7584
with:
7685
oss-fuzz-project-name: 'curl'
7786
fuzz-seconds: 120
7887
dry-run: false
7988
- name: Upload Crash
8089
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
81-
if: failure()
90+
if: ${{ failure() }}
8291
with:
8392
name: artifacts
8493
path: ./out/artifacts
8594

86-
Mainline:
87-
strategy:
88-
matrix:
89-
sanitizer:
90-
- address
91-
- memory
92-
93-
runs-on: ubuntu-latest
94-
steps:
95-
- name: Checkout
96-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
97-
with:
98-
repository: curl/curl-fuzzer
99-
- name: Install Dependencies
100-
run: |
101-
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
102-
sudo apt-get -o Dpkg::Use-Pty=0 update
103-
sudo rm -f /var/lib/man-db/auto-update
104-
sudo apt-get -o Dpkg::Use-Pty=0 install -y cmake clang ninja-build
105-
- name: Compile mainline
106-
env:
107-
# test with different "sanitizers"
108-
SANITIZER: ${{ matrix.sanitizer }}
109-
run: ./mainline.sh
110-
111-
just_dependencies:
112-
runs-on: ubuntu-latest
113-
steps:
114-
- name: Checkout
115-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
116-
with:
117-
repository: curl/curl-fuzzer
118-
- name: Install Dependencies
119-
run: |
120-
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
121-
sudo apt-get -o Dpkg::Use-Pty=0 update
122-
sudo rm -f /var/lib/man-db/auto-update
123-
sudo apt-get -o Dpkg::Use-Pty=0 install -y cmake clang ninja-build
124-
- name: Compile deps target
125-
run: ./scripts/compile_target.sh deps
126-
127-
PythonTests:
128-
runs-on: ubuntu-latest
129-
steps:
130-
- name: Checkout
131-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
132-
with:
133-
repository: curl/curl-fuzzer
134-
- name: Set up Python
135-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
136-
with:
137-
python-version: '3.12'
138-
- name: Install test dependencies
139-
run: |
140-
python -m pip install --upgrade pip
141-
pip install pytest
142-
- name: Run TLV constants sync test
143-
run: pytest tests/test_tlv_constants_sync.py
144-
14595
# Ensure that the repository can be built for i386
14696
Testi386:
97+
name: 'Test i386'
14798
runs-on: ubuntu-latest
14899
steps:
149-
- name: Build Fuzzers
150-
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
151-
with:
152-
oss-fuzz-project-name: 'curl'
153-
dry-run: false
154-
keep-unaffected-fuzz-targets: true
155-
architecture: 'i386'
100+
- name: Build Fuzzers
101+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master # zizmor: ignore[unpinned-uses]
102+
with:
103+
oss-fuzz-project-name: 'curl'
104+
dry-run: false
105+
keep-unaffected-fuzz-targets: true
106+
architecture: 'i386'

.github/workflows/codeql.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ name: 'CodeQL'
1111
- cron: '0 0 * * 4'
1212

1313
concurrency:
14-
group: ${{ github.workflow }}
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
15+
cancel-in-progress: true
1516

1617
permissions: {}
1718

.github/workflows/pages-ci.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
11
name: Playwright browser test for corpus decoder
22

3-
on:
3+
'on':
44
push:
5-
branches: [master]
5+
branches:
6+
- master
67
pull_request:
7-
branches: [master]
8+
branches:
9+
- master
810
workflow_dispatch:
911

10-
permissions:
11-
contents: read
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
14+
cancel-in-progress: true
15+
16+
permissions: {}
1217

1318
jobs:
1419
test:
20+
name: 'Test pages'
1521
runs-on: ubuntu-latest
1622
steps:
17-
- name: Checkout
18-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
with:
25+
persist-credentials: false
1926

20-
- name: Set up Python
21-
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
27+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
2228
with:
23-
python-version: "3.12"
29+
python-version: '3.12'
2430

2531
- name: Install dependencies
2632
run: |
27-
python -m pip install --upgrade pip
28-
pip install .[browser-tests]
29-
pip install pytest pytest-playwright
33+
pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary '.[page-gen,browser-tests]'
3034
python -m playwright install
3135
3236
- name: Install Playwright system dependencies
3337
run: |
38+
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
39+
sudo rm -f /var/lib/man-db/auto-update
3440
playwright install-deps
3541
3642
- name: Run Playwright browser test

0 commit comments

Comments
 (0)