| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- name: Tests
- on:
- push:
- branches:
- - main
- workflow_dispatch:
- pull_request:
- branches:
- - main
- workflow_call:
- # Set default permissions for all jobs
- permissions:
- contents: read # Needed to check out code
- checks: write # Needed to report test results
- pull-requests: write # Needed to add comments/annotations to PRs
- jobs:
- quality-checks:
- runs-on: ubuntu-latest
- name: Quality Checks
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Setup Node.js environment
- uses: actions/setup-node@v4
- with:
- node-version: 22
- - name: Cache root dependencies
- uses: actions/cache@v4
- id: root-cache
- with:
- path: node_modules
- key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- - name: Cache webview-ui dependencies
- uses: actions/cache@v4
- id: webview-cache
- with:
- path: webview-ui/node_modules
- key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
- - name: Install root dependencies
- if: steps.root-cache.outputs.cache-hit != 'true'
- run: npm ci
- - name: Install webview-ui dependencies
- if: steps.webview-cache.outputs.cache-hit != 'true'
- run: cd webview-ui && npm ci
- - name: Run Quality Checks (Parallel)
- run: npm run ci:check-all
- test:
- needs: quality-checks
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, windows-latest]
- runs-on: ${{ matrix.os }}
- name: ${{ matrix.os == 'ubuntu-latest' && 'test' || format('test ({0})', matrix.os) }}
- defaults:
- run:
- shell: bash
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Setup Node.js environment
- uses: actions/setup-node@v4
- with:
- node-version: 22
- - name: Cache root dependencies
- uses: actions/cache@v4
- id: root-cache
- with:
- path: node_modules
- key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- - name: Cache webview-ui dependencies
- uses: actions/cache@v4
- id: webview-cache
- with:
- path: webview-ui/node_modules
- key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
- - name: Install root dependencies
- if: steps.root-cache.outputs.cache-hit != 'true'
- run: npm ci
- - name: Install webview-ui dependencies
- if: steps.webview-cache.outputs.cache-hit != 'true'
- run: cd webview-ui && npm ci
- - name: Set up NPM on Windows
- if: runner.os == 'Windows'
- run: |
- npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"
- # Build the extension and tests (without redundant checks)
- - name: Build Tests and Extension
- id: build_step
- run: npm run ci:build
- - name: Unit Tests with coverage - Linux
- id: unit_tests_linux
- if: ${{ !cancelled() && steps.build_step.outcome == 'success' && runner.os == 'Linux' }}
- run: |
- npx nyc --nycrc-path .nycrc.unit.json --reporter=lcov npm run test:unit
- - name: Unit Tests - Non-Linux
- id: unit_tests_non_linux
- if: ${{ !cancelled() && steps.build_step.outcome == 'success' && runner.os != 'Linux' }}
- run: |
- npm run test:unit
- - name: Extension Integration Tests - Linux
- id: integration_tests_linux
- if: ${{ !cancelled() && steps.build_step.outcome == 'success' && runner.os == 'Linux' }}
- run: xvfb-run -a npm run test:coverage
- - name: Extension Integration Tests - Non-Linux
- id: integration_tests_non_linux
- if: ${{ !cancelled() && steps.build_step.outcome == 'success' && runner.os != 'Linux' }}
- run: npm run test:integration
- - name: Webview Tests with Coverage
- id: webview_tests
- if: ${{ !cancelled() && steps.build_step.outcome == 'success' }}
- run: |
- cd webview-ui
- npm run test:coverage
- - name: Save Coverage Reports
- uses: actions/upload-artifact@v4
- # Only upload artifacts on Linux - We only need coverage from one OS
- if: runner.os == 'Linux'
- with:
- name: pr-coverage-reports
- path: |
- coverage-unit/lcov.info
- webview-ui/coverage/lcov.info
- test-platform-integration:
- needs: quality-checks
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Setup Node.js environment
- uses: actions/setup-node@v4
- with:
- node-version: 22
-
- - name: Cache root dependencies
- uses: actions/cache@v4
- id: root-cache
- with:
- path: node_modules
- key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- - name: Cache webview-ui dependencies
- uses: actions/cache@v4
- id: webview-cache
- with:
- path: webview-ui/node_modules
- key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
- # Cache testing-platform dependencies
- - name: Cache testing-platform dependencies
- uses: actions/cache@v4
- id: testing-platform-cache
- with:
- path: testing-platform/node_modules
- key: ${{ runner.os }}-npm-testing-platform-${{ hashFiles('testing-platform/package-lock.json') }}
- - name: Install root dependencies
- if: steps.root-cache.outputs.cache-hit != 'true'
- run: npm ci
- - name: Install webview-ui dependencies
- if: steps.webview-cache.outputs.cache-hit != 'true'
- run: cd webview-ui && npm ci
- - name: Setup Go
- uses: actions/setup-go@v5
- with:
- go-version: '1.24'
- cache-dependency-path: cli/go.sum
- - name: Build CLI binaries
- run: npm run compile-cli-all-platforms
- - name: Download ripgrep binaries
- run: npm run download-ripgrep
- - name: Compile NPM package
- run: npm run compile-standalone-npm
- - name: Install testing platform dependencies
- if: steps.testing-platform-cache.outputs.cache-hit != 'true'
- run: cd testing-platform && npm ci
- - name: Running testing platform integration spec tests
- continue-on-error: true
- timeout-minutes: 7
- # Temporarily wrapping the test command to always return a neutral exit code.
- # This prevents the job from showing as failed and avoids distracting developers
- # until the integration tests are ready to be enforced.
- run: |
- npm run test:tp-orchestrator -- tests/specs/ --count=1 --coverage || true
- - name: Save Coverage Reports
- uses: actions/upload-artifact@v4
- with:
- name: test-platform-integration-core-coverage
- path: coverage/**/lcov.info
- qlty:
- needs: [test, test-platform-integration]
- runs-on: ubuntu-latest
- # Run on PRs to main, pushes to main, and manual dispatches
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Download unit tests coverage reports
- uses: actions/download-artifact@v4
- with:
- name: pr-coverage-reports
- path: .
- - name: Upload core unit tests coverage to Qlty
- uses: qltysh/qlty-action/coverage@v2
- with:
- token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
- # we can merge multiple files if necessary
- files: |
- coverage-unit/lcov.info
- tag: unit:core
- - name: Upload webview-ui unit tests coverage to Qlty
- uses: qltysh/qlty-action/coverage@v2
- with:
- token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
- # we can merge multiple files if necessary
- files: |
- webview-ui/coverage/lcov.info
- tag: unit:webview-ui
- add-prefix: webview-ui/
- - name: Download test platform integration core coverage artifact
- uses: actions/download-artifact@v4
- continue-on-error: true
- id: download-integration-coverage
- with:
- name: test-platform-integration-core-coverage
- path: integration-core-coverage-reports
- - name: Upload core integration tests coverage to Qlty
- if: steps.download-integration-coverage.outcome == 'success'
- uses: qltysh/qlty-action/coverage@v2
- with:
- token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
- files: integration-core-coverage-reports/**/lcov.info
- tag: integration:core
|