test(tests): update CLI e2e mock response format #15
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: CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [20, 22] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check for merge conflict markers | |
| run: | | |
| if git grep -nE '^(<<<<<<<|=======|>>>>>>>)' -- .; then | |
| echo "Merge conflict markers found in tracked files." >&2 | |
| exit 1 | |
| fi | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run quality checks | |
| run: npm run check | |
| - name: Build package | |
| run: npm run build | |
| - name: Package smoke test | |
| run: npm pack --ignore-scripts | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| - name: Upgrade npm for trusted publishing | |
| run: npm install --global npm@^11.5.1 | |
| - name: Verify npm supports trusted publishing | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| NPM_VERSION="$(npm --version)" | |
| echo "Detected npm ${NPM_VERSION}" | |
| IFS='.' read -r major minor patch <<< "${NPM_VERSION}" | |
| if (( major < 11 || (major == 11 && minor < 5) || (major == 11 && minor == 5 && patch < 1) )); then | |
| echo "npm ${NPM_VERSION} is too old for trusted publishing; require >= 11.5.1. Upgrade npm in the publish job or remove this gate only if npm documents a lower supported version." >&2 | |
| exit 1 | |
| fi | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build package | |
| run: npm run build | |
| - name: Check whether this version is already published | |
| id: npm_version | |
| run: | | |
| VERSION="$(node -p "require('./package.json').version")" | |
| NAME="$(node -p "require('./package.json').name")" | |
| echo "package_name=$NAME" >> "$GITHUB_OUTPUT" | |
| echo "package_version=$VERSION" >> "$GITHUB_OUTPUT" | |
| if npm view "$NAME@$VERSION" version >/dev/null 2>&1; then | |
| echo "should_publish=false" >> "$GITHUB_OUTPUT" | |
| echo "Version $VERSION is already published. Skipping npm publish." | |
| else | |
| echo "should_publish=true" >> "$GITHUB_OUTPUT" | |
| echo "Version $VERSION is not published yet. Proceeding." | |
| fi | |
| - name: Publish to npm | |
| if: steps.npm_version.outputs.should_publish == 'true' | |
| run: npm publish --access public --provenance |