current commit
261001.6 · build(deps): bump actions/checkout from 6.0.2 to 7.0.0 (#867)
name: CI

on: [push, pull_request]

env:
  CI: true

permissions:
  contents: read

jobs:
  ci:
    name: Build, Test and Lint
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - macos-latest
          - ubuntu-latest
          - windows-latest
    steps:
      - name: Install clang for Windows
        if: runner.os == 'Windows'
        run: |
          iwr -useb get.scoop.sh -outfile 'install.ps1'
          .\install.ps1 -RunAsAdmin
          scoop install llvm --global

          # Scoop modifies the PATH so we make the modified PATH global.
          echo $env:PATH >> $env:GITHUB_PATH

      - name: Setup Node.js
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: 20.18.0

      - name: Setup Docker
        uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
        if: runner.os == 'Linux'

      - name: Fetch
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          fetch-depth: 1

      # Skip macOS & Windows, cache there is slower
      - name: Restore node_modules cache for Linux
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

      - name: Install dependencies
        run: npm ci

      - name: Build libllhttp.a
        shell: bash
        run: |
          make build/libllhttp.a

      - name: Build WebAssembly
        run: npm run build-wasm
        if: runner.os == 'Linux'

      - name: Run tests
        run: npm run test

      - name: Lint Code
        run: npm run lint
        if: runner.os == 'Linux'