π E2E Tests #46
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: | |
| workflow_dispatch: | |
| jobs: | |
| e2e: | |
| name: E2E | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Install and compile extension | |
| run: | | |
| npm ci | |
| npm run compile | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.24.0 | |
| - name: Install E2E dependencies | |
| run: pnpm install | |
| working-directory: test/e2e | |
| - name: Run E2E tests | |
| uses: GabrielBB/xvfb-action@v1 | |
| with: | |
| run: pnpm test:e2e | |
| working-directory: test/e2e | |
| env: | |
| E2E_CLOUD: ${{ secrets.E2E_CLOUD }} | |
| E2E_API_KEY: ${{ secrets.E2E_API_KEY }} | |
| E2E_API_SECRET: ${{ secrets.E2E_API_SECRET }} | |
| CI: true | |
| - name: Generate Allure report | |
| if: always() | |
| run: pnpm exec allure generate allure-results -o allure-report --clean | |
| working-directory: test/e2e | |
| - name: Upload Allure report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-report-${{ github.run_number }} | |
| path: test/e2e/allure-report | |
| retention-days: 30 | |
| - name: Set timestamp. | |
| if: always() | |
| id: timestamp | |
| run: echo "TIMESTAMP=$(date +%Y%m%d_%H%M%S_%3N)" >> $GITHUB_ENV | |
| - name: Generate GitHub App token. | |
| if: always() | |
| id: app-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| owner: cloudinary-devs | |
| repositories: cld-vscode-test-allure-reports | |
| # How to update the GitHub App token (need to be updated every year): | |
| # 1. Create a GitHub App at https://github.com/organizations/cloudinary-devs/settings/apps | |
| # - Name: cloudinary-devs-bot, Webhook: unchecked, Permissions: Contents (Read & write), Install: Only this account | |
| # 2. Note the App ID, then generate a private key (Settings β Private keys β Generate). Save the .pem file. | |
| # 3. Install the app: App settings β Install App β cloudinary-devs org β Only select repositories β cld-vscode-test-allure-reports | |
| # 4. Add secrets to this repo (Settings β Secrets β Actions): APP_ID and APP_PRIVATE_KEY (.pem contents) | |
| # 5. The token is generated above via actions/create-github-app-token using those secrets. | |
| - name: Pushes to reports repository. | |
| if: always() | |
| uses: cpina/github-action-push-to-another-repository@main | |
| env: | |
| API_TOKEN_GITHUB: ${{ steps.app-token.outputs.token }} | |
| with: | |
| source-directory: 'test/e2e/allure-report' | |
| destination-github-username: 'cloudinary-devs' | |
| destination-repository-name: 'cld-vscode-test-allure-reports' | |
| user-email: '' | |
| target-branch: main | |
| target-directory: 'allure-report_ts_${{ env.TIMESTAMP }}' | |
| - name: Write URL in summary. | |
| if: always() | |
| run: echo "### Test results https://jubilant-broccoli-www5lem.pages.github.io/allure-report_ts_${{ env.TIMESTAMP }}" >> $GITHUB_STEP_SUMMARY |