Merge pull request #207 from cluesmith/builder/bugfix-205-terminal-re… #560
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: E2E Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| schedule: | |
| # Run daily at 9am UTC (2am PST / 5am EST) | |
| - cron: '0 9 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| e2e: | |
| name: E2E Tests (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install BATS | |
| run: | | |
| if [[ "$RUNNER_OS" == "Linux" ]]; then | |
| sudo apt-get update | |
| sudo apt-get install -y bats | |
| else | |
| brew install bats-core | |
| fi | |
| - name: Install package dependencies | |
| working-directory: packages/codev | |
| run: npm install | |
| - name: Build package | |
| working-directory: packages/codev | |
| run: npm run build | |
| - name: Create tarball | |
| working-directory: packages/codev | |
| run: npm pack | |
| - name: Run E2E tests | |
| env: | |
| E2E_TARBALL: ${{ github.workspace }}/packages/codev/cluesmith-codev-*.tgz | |
| run: bats tests/e2e/ | |
| - name: Upload test artifacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-test-logs-${{ matrix.os }} | |
| path: | | |
| packages/codev/*.tgz | |
| retention-days: 7 | |
| notify: | |
| name: Discord Notification | |
| needs: e2e | |
| if: always() && github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Discord notification | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| run: | | |
| if [ "${{ needs.e2e.result }}" == "success" ]; then | |
| COLOR=3066993 # Green | |
| STATUS="✅ Passed" | |
| else | |
| COLOR=15158332 # Red | |
| STATUS="❌ Failed" | |
| fi | |
| curl -H "Content-Type: application/json" \ | |
| -d "{\"embeds\": [{\"title\": \"Codev E2E Tests - ${STATUS}\", \"description\": \"Scheduled daily E2E test run completed.\", \"color\": ${COLOR}, \"fields\": [{\"name\": \"Result\", \"value\": \"${{ needs.e2e.result }}\", \"inline\": true}, {\"name\": \"Run\", \"value\": \"[View Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\", \"inline\": true}], \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}]}" \ | |
| $DISCORD_WEBHOOK |