Run Tests #254
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: Run Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'debug*' | |
| pull_request: | |
| schedule: | |
| - cron: '0 6 * * *' # 6am daily | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Run Tests | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up NodeJS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Checkout E2E tests | |
| uses: actions/checkout@v4 | |
| with: | |
| path: e2e-tests | |
| - name: Checkout Dart extension | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Dart-Code/Dart-Code | |
| path: Dart-Code | |
| submodules: 'recursive' | |
| - name: Build Dart extension | |
| run: | | |
| npm ci | |
| npm run vscode:prepublish | |
| working-directory: Dart-Code | |
| - name: Checkout Flutter extension | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Dart-Code/Flutter | |
| path: Flutter-Code | |
| - name: Build Flutter extension | |
| run: | | |
| npm ci | |
| npm run vscode:prepublish | |
| working-directory: Flutter-Code | |
| - name: Checkout Flutter SDK | |
| run: git clone https://github.com/flutter/flutter | |
| - name: Add Flutter SDK to PATH | |
| run: echo "${{github.workspace}}/flutter/bin" >> $GITHUB_PATH | |
| - run: dart --disable-analytics | |
| - name: Run 'flutter doctor' | |
| run: flutter doctor | |
| - name: Create Sample App | |
| run: flutter pub get | |
| working-directory: e2e-tests/test-apps/flutter_counter | |
| - name: Install VS Code | |
| run: | | |
| sudo apt-get install wget gpg | |
| wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg | |
| sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg | |
| echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null | |
| rm -f packages.microsoft.gpg | |
| sudo apt update | |
| sudo apt install -y code | |
| - name: Install dependencies | |
| working-directory: e2e-tests | |
| run: npm ci | |
| - name: Run tests | |
| working-directory: e2e-tests | |
| run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" npm test | |
| - name: Upload test result artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-reports | |
| path: | | |
| e2e-tests/playwright-report/ | |
| e2e-tests/test-results/ | |
| - name: Set CTRF results as GitHub summary | |
| if: ${{ !cancelled() }} | |
| run: npx -y github-actions-ctrf e2e-tests/test-results/ctrf-report.json | |
| notify_failure: | |
| permissions: | |
| contents: none | |
| name: Notify Discord of Failure | |
| needs: test | |
| if: failure() && github.event_name == 'push' || failure() && github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send notification to Discord | |
| run: 'Invoke-WebRequest -Headers @{ "Content-Type" = "application/json" } -Method Post -Body "{`"content`":`"Build failed on $($env:GITHUB_REF.Replace(`"refs/heads/`", `"`")): https://github.com/Dart-Code/E2E-Tests/commit/$($env:GITHUB_SHA)/checks`"}" -Uri $env:DISCORD_WEBHOOK' | |
| shell: pwsh | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} |