Testing: Comprehensive test coverage for weAudit #16
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: Tests | |
| on: | |
| push: | |
| branches: [main, testing] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm run test:unit | |
| - name: Generate coverage report | |
| run: npm run coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| extension-tests: | |
| name: Extension Tests (${{ matrix.os }}, ${{ matrix.vscode-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| vscode-version: [stable, insiders] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Compile extension | |
| run: npm run compile | |
| # Linux requires a virtual display for VS Code | |
| - name: Run extension tests (Linux) | |
| if: runner.os == 'Linux' | |
| run: xvfb-run -a npm run test:ext | |
| env: | |
| DISPLAY: ":99" | |
| VSCODE_VERSION: ${{ matrix.vscode-version }} | |
| # Allow insiders to fail (may have breaking changes) | |
| continue-on-error: ${{ matrix.vscode-version == 'insiders' }} | |
| - name: Run extension tests (macOS/Windows) | |
| if: runner.os != 'Linux' | |
| run: npm run test:ext | |
| env: | |
| VSCODE_VERSION: ${{ matrix.vscode-version }} | |
| # Allow insiders to fail (may have breaking changes) | |
| continue-on-error: ${{ matrix.vscode-version == 'insiders' }} | |
| build: | |
| name: Build Extension | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build production package | |
| run: npm run package | |
| - name: Verify build output | |
| run: | | |
| test -f out/extension.js || (echo "Extension build failed" && exit 1) | |
| echo "Build successful" |