--- name: Linters on: push: branches: [main] pull_request: branches: [main] merge_group: types: [checks_requested] branches: [main] permissions: contents: read jobs: cppcheck: runs-on: ubuntu-latest env: CPPCHECK_INSTALL_DIR: test-deps/cppcheck steps: - uses: actions/checkout@v7 - name: Setup run: source ./codebuild/bin/s2n_setup_env.sh - name: Cache id: cache uses: actions/cache@v5 continue-on-error: true with: path: ${{ env.CPPCHECK_INSTALL_DIR }} key: cppcheck-2.3-${{ env.CPPCHECK_INSTALL_DIR }} - name: Install if: steps.cache.outputs.cache-hit != 'true' run: ./codebuild/bin/install_cppcheck.sh "$CPPCHECK_INSTALL_DIR" - name: Check run: ./codebuild/bin/run_cppcheck.sh "$CPPCHECK_INSTALL_DIR" headers: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - name: Setup run: source ./codebuild/bin/s2n_setup_env.sh - name: Check run: ./codebuild/bin/header_mistake_scanner.sh simple-mistakes: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - name: Setup run: source ./codebuild/bin/s2n_setup_env.sh - name: Check run: ./codebuild/bin/grep_simple_mistakes.sh comments: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - name: Setup run: source ./codebuild/bin/s2n_setup_env.sh - name: Install run: sudo apt update && sudo apt install -y kwstyle - name: Check run: | ./codebuild/bin/run_kwstyle.sh ./codebuild/bin/cpp_style_comment_linter.sh ruff: runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v7 - name: Set up uv uses: astral-sh/setup-uv@v7 - name: Run Ruff formatting check working-directory: tests/integrationv2 id: ruff_format run: uv run ruff format --diff . continue-on-error: true - name: Check format exit code if: steps.ruff_format.outcome == 'failure' run: | echo "Run 'uv run ruff format .' to fix formatting issues" exit 1 - name: Run Ruff lint check working-directory: tests/integrationv2 id: ruff_lint run: uv run ruff check . continue-on-error: true - name: Check lint exit code if: steps.ruff_lint.outcome == 'failure' run: | echo "Linting issues detected. Run 'uv run ruff check .' locally to see errors and fix them." exit 1 clang-format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - name: clang-format check uses: jidicula/clang-format-action@v4.18.0 with: clang-format-version: '18' include-regex: '^(\.\/)?(api|bin|crypto|stuffer|error|tls|utils|tests\/unit|tests\/testlib|docs\/examples).*\.(c|h)$' nixflake: # The nix develop changes contain broken nixpkg dependenecies; the allow/impure flags workaround this. runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: nixbuild/nix-quick-install-action@v35 with: nix_conf: experimental-features = nix-command flakes - name: nix flake check run: NIXPKGS_ALLOW_BROKEN=1 NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix flake check --impure nixfmt: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: nixbuild/nix-quick-install-action@v35 with: nix_conf: experimental-features = nix-command flakes - name: nix fmt run: nix fmt $(find . -name \*nix -type f -not -path "./.git/*") - name: Changed files id: dirty run: | echo "Checking nix files with: nix fmt ..." git diff --exit-code continue-on-error: true - name: Failure case if: steps.dirty.outcome != 'success' run: | echo "Please fix formatting with nix fmt (file)" exit 1 - name: Success run: echo "All nix files passed format check"