Fix npm Audit: bump fast-uri, brace-expansion, js-yaml overrides #1402
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| lint-actions: | |
| name: GitHub Actions audit | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Run actionlint | |
| uses: rhysd/actionlint@914e7df21a07ef503a81201c76d2b11c789d3fca # v1.7.12 | |
| - name: Run zizmor | |
| uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7 | |
| with: | |
| advanced-security: false | |
| smithy: | |
| uses: ./.github/workflows/smithy-verify.yml | |
| permissions: | |
| contents: read | |
| provenance: | |
| name: Provenance | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Verify embedded provenance is up to date | |
| run: diff -q spec/api-provenance.json go/pkg/basecamp/api-provenance.json | |
| test-go: | |
| name: Go Tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: go | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: 'go/go.mod' | |
| cache-dependency-path: 'go/go.sum' | |
| - name: Build | |
| run: go build ./... | |
| - name: Check service layer drift | |
| run: ../scripts/check-service-drift.sh | |
| - name: Check auth-routable consumer invariants | |
| run: ../scripts/check-auth-routable-consumers.sh | |
| - name: Test with coverage | |
| run: | | |
| # Measure coverage for hand-written code only (generated code is excluded) | |
| go test -v -coverprofile=coverage.out ./pkg/basecamp/... ./pkg/types/... | |
| go tool cover -func=coverage.out | tail -1 | |
| COVERAGE=$(go tool cover -func=coverage.out | tail -1 | awk '{print $NF}' | sed 's/%//') | |
| echo "Total coverage: ${COVERAGE}%" | |
| if [ "$(echo "$COVERAGE < 25" | bc -l)" -eq 1 ]; then | |
| echo "::error::Coverage ${COVERAGE}% is below minimum threshold of 25%" | |
| exit 1 | |
| fi | |
| test-typescript: | |
| name: TypeScript Tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: typescript | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: typescript/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Test | |
| run: npm run test | |
| - name: Build | |
| run: npm run build | |
| - name: Verify root pack includes compiled SDK | |
| working-directory: . | |
| run: | | |
| FILES=$(npm pack --ignore-scripts --json | jq -r '.[0].files[].path') | |
| echo "$FILES" | grep -q '^typescript/dist/index\.js$' | |
| echo "$FILES" | grep -q '^typescript/dist/index\.d\.ts$' | |
| test-ruby: | |
| name: Ruby ${{ matrix.ruby }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ['3.2', '3.3', '3.4', '4.0', 'head'] | |
| continue-on-error: ${{ matrix.ruby == 'head' }} | |
| defaults: | |
| run: | |
| working-directory: ruby | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Ruby | |
| if: matrix.ruby != 'head' | |
| uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| working-directory: ruby | |
| - name: Set up Ruby head | |
| if: matrix.ruby == 'head' | |
| uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler: default | |
| bundler-cache: true | |
| working-directory: ruby | |
| - name: Lint | |
| if: matrix.ruby == '3.3' | |
| run: bundle exec rubocop | |
| - name: Test | |
| run: bundle exec rake test | |
| test-python: | |
| name: Python ${{ matrix.python }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.11', '3.12', '3.13', '3.14'] | |
| continue-on-error: ${{ matrix.python == '3.14' }} | |
| defaults: | |
| run: | |
| working-directory: python | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python }} | |
| - name: Install dependencies | |
| run: uv sync --dev --python ${{ matrix.python }} | |
| - name: Lint | |
| if: matrix.python == '3.13' | |
| run: | | |
| uv run ruff check src/ tests/ | |
| uv run ruff format --check src/ tests/ | |
| - name: Type check | |
| if: matrix.python == '3.13' | |
| run: uv run mypy src/basecamp/ --ignore-missing-imports | |
| - name: Check generated code drift | |
| if: matrix.python == '3.13' | |
| run: | | |
| uv run python scripts/generate_services.py | |
| uv run python scripts/generate_metadata.py | |
| uv run python scripts/generate_types.py | |
| uv run ruff format src/basecamp/generated/ | |
| if [ -n "$(git status --porcelain -- src/basecamp/generated/)" ]; then | |
| echo "::error::Generated Python code is out of date. Run 'make py-generate' and commit." | |
| git status --short -- src/basecamp/generated/ | |
| git diff --stat -- src/basecamp/generated/ || true | |
| exit 1 | |
| fi | |
| echo "Generated code is up to date" | |
| - name: Test with coverage | |
| run: uv run pytest --cov --cov-report=term-missing --cov-fail-under=60 | |
| test-swift: | |
| name: Swift Tests | |
| runs-on: macos-15 | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: swift | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Build | |
| run: swift build | |
| - name: Test | |
| run: swift test | |
| test-kotlin: | |
| name: Kotlin Tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: kotlin | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Java | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 | |
| with: | |
| cache-provider: basic | |
| - name: Build | |
| run: ./gradlew :basecamp-sdk:build | |
| - name: Test | |
| run: ./gradlew :basecamp-sdk:check | |
| - name: Check generated code drift | |
| run: | | |
| ./gradlew :generator:run --args="--openapi ../openapi.json --behavior ../behavior-model.json --output sdk/src/commonMain/kotlin/com/basecamp/sdk/generated" | |
| if [ -n "$(git status --porcelain -- sdk/src/commonMain/kotlin/com/basecamp/sdk/generated/)" ]; then | |
| echo "::error::Generated Kotlin code is out of date. Run 'make kt-generate-services' and commit." | |
| git status --short -- sdk/src/commonMain/kotlin/com/basecamp/sdk/generated/ | |
| git diff --stat -- sdk/src/commonMain/kotlin/com/basecamp/sdk/generated/ || true | |
| exit 1 | |
| fi | |
| echo "Generated code is up to date" | |
| conformance: | |
| name: Conformance Tests | |
| runs-on: ubuntu-latest | |
| needs: [test-go, test-typescript, test-ruby, test-kotlin, test-python] | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: conformance/runner/go | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: 'conformance/runner/go/go.mod' | |
| cache-dependency-path: 'conformance/runner/go/go.sum' | |
| - name: Build conformance runner | |
| run: go build -o conformance-runner . | |
| - name: Run Go conformance tests | |
| run: ./conformance-runner | |
| - name: Set up Java | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 | |
| with: | |
| cache-provider: basic | |
| - name: Run Kotlin conformance tests | |
| working-directory: kotlin | |
| run: ./gradlew :conformance:run | |
| - name: Set up Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: conformance/runner/typescript/package-lock.json | |
| - name: Build TypeScript SDK | |
| working-directory: typescript | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Run TypeScript conformance tests | |
| working-directory: conformance/runner/typescript | |
| run: | | |
| npm ci | |
| npm test | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@d45b1a4e94b71acab930e56e79c6aa188764e7f9 # v1.316.0 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true | |
| working-directory: conformance/runner/ruby | |
| - name: Run Ruby conformance tests | |
| working-directory: conformance/runner/ruby | |
| run: ruby runner.rb | |
| - name: Install uv (Python) | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| - name: Run Python conformance tests | |
| working-directory: conformance/runner/python | |
| run: | | |
| uv sync | |
| uv run python runner.py | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: 'go/go.mod' | |
| cache-dependency-path: 'go/go.sum' | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 | |
| with: | |
| working-directory: go | |
| version: latest | |
| args: --config .golangci.yml | |
| race: | |
| name: Race Detection | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: go | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: 'go/go.mod' | |
| cache-dependency-path: 'go/go.sum' | |
| - name: Test with race detector | |
| run: go test -race -v ./... | |
| api-compat: | |
| name: API Compatibility | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| working-directory: go | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up Go | |
| uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 | |
| with: | |
| go-version-file: 'go/go.mod' | |
| cache-dependency-path: 'go/go.sum' | |
| - name: Cache Go tools | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/go/bin | |
| key: go-tools-${{ runner.os }}-go${{ hashFiles('go/go.mod') }}-apidiff-v0.9.0 | |
| - name: Install apidiff | |
| run: | | |
| command -v apidiff || go install golang.org/x/exp/cmd/apidiff@v0.0.0-20241217172543-b2144cdd0a67 | |
| - name: Check for breaking API changes | |
| run: | | |
| # Store the current commit SHA | |
| PR_SHA="${{ github.event.pull_request.head.sha }}" | |
| BASE_REF="${GITHUB_BASE_REF}" | |
| # Export the current (PR) API | |
| apidiff -w pr.api ./pkg/basecamp | |
| # Find files added in PR that don't exist on base branch | |
| # These need to be removed after checkout since git checkout doesn't remove them | |
| # Strip 'go/' prefix since we're running from go/ directory | |
| ADDED_FILES=$(git diff --name-only --diff-filter=A "origin/${BASE_REF}" -- . 2>/dev/null | sed 's|^go/||' || true) | |
| # Check out the base branch to compare against | |
| git checkout "origin/${BASE_REF}" -- . | |
| # Remove files that were added in PR (they don't exist on base) | |
| if [ -n "$ADDED_FILES" ]; then | |
| echo "Removing files added in PR:" | |
| echo "$ADDED_FILES" | |
| echo "$ADDED_FILES" | xargs rm -f | |
| fi | |
| # Export the base API | |
| apidiff -w base.api ./pkg/basecamp | |
| # Restore the PR version using the stored SHA | |
| git checkout "${PR_SHA}" -- . | |
| # Compare APIs and report breaking changes | |
| echo "## API Compatibility Check" | |
| echo "" | |
| if apidiff -incompatible base.api pr.api > breaking.txt 2>&1; then | |
| if [ -s breaking.txt ]; then | |
| echo "### Breaking Changes Detected" | |
| echo "" | |
| echo "The following incompatible API changes were found:" | |
| echo "" | |
| echo '```' | |
| cat breaking.txt | |
| echo '```' | |
| echo "" | |
| echo "If these changes are intentional, ensure they are documented in the changelog." | |
| # Don't fail the build, just warn | |
| else | |
| echo "No breaking changes detected." | |
| fi | |
| else | |
| echo "No breaking changes detected." | |
| fi | |
| # Also show all changes for reference | |
| echo "" | |
| echo "### All API Changes" | |
| echo "" | |
| if apidiff base.api pr.api > changes.txt 2>&1 && [ -s changes.txt ]; then | |
| echo '```' | |
| cat changes.txt | |
| echo '```' | |
| else | |
| echo "No API changes detected." | |
| fi |