feat: enhance Excel export functionality and improve test coverage #348
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| # Cancel superseded runs on the same ref (main runs are kept so deploy is not interrupted). | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| contents: read | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| VITE_DEFAULT_EXCEL_ID: ${{ vars.VITE_DEFAULT_EXCEL_ID }} | |
| ROOT_BASE_URL: ${{ vars.ROOT_BASE_URL }} | |
| COMMIT_ID: ${{ github.sha }} | |
| jobs: | |
| CI: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: lts/* | |
| cache: yarn | |
| - name: Install font | |
| run: sudo npm run install-font | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: echo "version=$(yarn --silent playwright --version | awk '{print $NF}')" >> "$GITHUB_OUTPUT" | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: yarn playwright install --with-deps | |
| - name: Install Playwright system dependencies | |
| if: steps.playwright-cache.outputs.cache-hit == 'true' | |
| run: yarn playwright install-deps | |
| - name: Type check | |
| run: yarn type-check | |
| - name: Lint | |
| run: yarn lint | |
| - name: Unit test | |
| run: yarn coverage --verbose --debug | |
| - name: Upload coverage | |
| if: github.ref == 'refs/heads/main' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| report_type: test_results | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: E2E tests | |
| run: yarn e2e | |
| env: | |
| CI: true | |
| - name: Upload Playwright test report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 5 | |
| - name: Build | |
| run: yarn build | |
| - name: Deploy to GitHub Pages | |
| if: github.ref == 'refs/heads/main' | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./packages/demo/frontend/dist | |
| - name: Verify deployment | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| echo "Checking if site is accessible..." | |
| commit_id="${{ github.sha }}" | |
| max_retries=5 | |
| retry_interval=5 | |
| for i in $(seq 1 $max_retries); do | |
| echo "Attempt $i/$max_retries: Waiting ${retry_interval}s for deployment to propagate..." | |
| sleep $retry_interval | |
| response=$(curl -sL https://nusr.github.io/excel) | |
| if echo "$response" | grep -q "$commit_id"; then | |
| echo "✓ COMMIT_ID ($commit_id) successfully injected into HTML" | |
| echo "✓ Deployment successful!" | |
| exit 0 | |
| fi | |
| echo "Commit ID ($commit_id) not found yet, retrying..." | |
| done | |
| echo "✗ COMMIT_ID ($commit_id) verification failed after $max_retries attempts - commit ID not found in HTML!" | |
| exit 1 |