# Copyright (C) Daniel Stenberg, , et al. # # SPDX-License-Identifier: curl # This workflow contains checks at the source code level only. name: 'Source' 'on': push: branches: - master - 'curl-*' - '*/ci' paths-ignore: - 'appveyor.*' - 'Dockerfile' pull_request: branches: - master - 'curl-*' paths-ignore: - 'appveyor.*' - 'Dockerfile' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true permissions: {} cache-mode: none env: DO_NOT_TRACK: '1' jobs: checksrc: name: 'checksrc' runs-on: ubuntu-slim steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'check' run: scripts/checksrc-all.pl linters: name: 'spellcheck, linters, REUSE' runs-on: ubuntu-26.04-arm steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'cmake options in documentation' background: true run: scripts/cmakeopts.sh - name: 'labelercheck' background: true run: .github/scripts/labelercheck.sh - name: 'perlcheck' background: true run: scripts/perlcheck.sh - name: 'install brew packages' background: true timeout-minutes: 2 uses: $/.github/actions/pkg-install with: brew: pyrefly typos-cli - name: 'install prereqs' uses: $/.github/actions/pkg-install with: pip: | -r .github/scripts/requirements.txt -r tests/http/requirements.txt - name: 'REUSE check' background: true run: | source ~/venv/bin/activate reuse lint - name: 'cmakelint' background: true run: | source ~/venv/bin/activate scripts/cmakelint.sh - name: 'ruff' background: true run: | source ~/venv/bin/activate scripts/pythonlint.sh - name: 'wait-all' wait-all: - name: 'pyrefly' background: true run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" cd tests/http/ pyrefly check --python-version=3.8 --preset=basic --check-unannotated-defs --summary - name: filter off code from all C and H files run: | git ls-files -z '**.[ch]' | xargs -0 -r -n1 .github/scripts/c-strip - name: 'typos' background: true run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" typos --version .github/scripts/typos.sh - name: 'codespell' run: | source ~/venv/bin/activate codespell --version .github/scripts/codespell.sh pytype: name: 'pytype' runs-on: ubuntu-24.04-arm # pytype is discontinued and requires python 3.8-3.12 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'install prereqs' uses: $/.github/actions/pkg-install with: pip: | pytype==2024.10.11 -r .github/scripts/requirements.txt -r tests/http/requirements.txt - name: 'check' run: | source ~/venv/bin/activate find . -name '*.py' -exec pytype -j auto -k -- {} + complexity: name: 'complexity and function sizes' runs-on: ubuntu-slim timeout-minutes: 3 steps: - name: 'install pmccabe' timeout-minutes: 2 uses: $/.github/actions/pkg-install with: apt: pmccabe - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'check function complexity' run: ./scripts/top-complexity - name: 'check function lengths' run: ./scripts/top-length xmllint: name: 'xmllint' runs-on: ubuntu-slim timeout-minutes: 3 steps: - name: 'install prereqs' timeout-minutes: 2 uses: $/.github/actions/pkg-install with: apt: libxml2-utils - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'check' run: git grep -z -i -l -E '^<\?xml' | xargs -0 -r xmllint --output /dev/null miscchecks: name: 'misc checks' runs-on: ubuntu-26.04-arm timeout-minutes: 5 steps: - name: 'install prereqs' timeout-minutes: 2 uses: $/.github/actions/pkg-install with: brew: shellcheck zizmor - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'zizmor (prepare)' # Replace custom bash-like shell designators with the standard one to make linters process them run: sed -i.bak -E 's/shell\x3a .+ zizmor\x3a ignore.+$/shell\x3a bash/g' .github/workflows/*.yml - name: 'zizmor GHA' background: true env: GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" git ls-files '.github/actions/**/*.yml' '.github/dependabot.yml' '.github/workflows/*.yml' -z | xargs -0 -r zizmor --persona pedantic -- - name: 'zizmor GHA (auditor, warning-only)' background: true env: GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" git ls-files '.github/actions/**/*.yml' '.github/dependabot.yml' '.github/workflows/*.yml' -z | xargs -0 -r zizmor --persona auditor -- || true - name: 'shellcheck CI' background: true run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" shellcheck --version .github/scripts/shellcheck-ci.sh - name: 'shellcheck' background: true run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" shellcheck --version .github/scripts/shellcheck.sh - name: 'spacecheck' background: true run: scripts/spacecheck.pl - name: 'yamlcheck' background: true run: .github/scripts/yamlcheck.sh - name: 'badwords' run: scripts/badwords-all