name: Validate project on: push: branches: [main] pull_request: types: - opened - reopened - synchronize merge_group: branches: [main] types: [checks_requested] permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: lint: name: Build on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: &matrix-strategy fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout uses: actions/checkout@v7 - name: Build project uses: ./.github/actions/build with: save-cache: "true" - name: Check formatting, typed lint and production types if: ${{ matrix.os == 'ubuntu-latest' }} run: yarn verify test-packages: needs: lint name: Package tests on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: *matrix-strategy steps: - name: Checkout project uses: actions/checkout@v7 - name: Build project uses: ./.github/actions/build id: build with: yarn-hardened-mode: "0" - parallel: - name: Install Playwright browsers timeout-minutes: 5 run: yarn playwright install chromium firefox webkit - name: Install playwright dependencies for e2e timeout-minutes: 5 run: yarn playwright install-deps - name: Run tests shell: bash env: ENABLE_COVERAGE: ${{ matrix.os == 'ubuntu-latest' && 'true' || 'false' }} run: | yarn allure run \ --config=./allurerc.mjs \ --environment=${{ matrix.os }} \ --dump=allure-results-packages-${{ matrix.os }} \ -- \ yarn workspaces foreach -Avvp \ --exclude @allurereport/monorepo \ --exclude @allurereport/common-config \ --exclude @allurereport/e2e \ --exclude sandbox \ exec vp run -v vp:test - name: Upload test results timeout-minutes: 10 uses: actions/upload-artifact@v7 if: ${{ !cancelled() }} with: name: allure-results-packages-${{ matrix.os }} path: ./allure-results-packages-${{ matrix.os }}.zip - name: Upload blob reports uses: actions/upload-artifact@v7 if: ${{ matrix.os == 'ubuntu-latest' && !cancelled() }} with: name: vitest-blobs-${{ matrix.os }} path: packages/*/.vitest/blob/*.json include-hidden-files: true if-no-files-found: error test-e2e: needs: lint name: E2E tests on ${{ matrix.os }} ${{ matrix.shard }}/2 runs-on: ${{ matrix.os }} env: SHARDS_TOTAL: "2" strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] shard: [1, 2] steps: - name: Checkout project uses: actions/checkout@v7 - name: Build project uses: ./.github/actions/build id: build with: yarn-hardened-mode: "0" - parallel: - name: Install Playwright browsers timeout-minutes: 5 run: yarn playwright install chromium firefox webkit - name: Install playwright dependencies for e2e timeout-minutes: 5 run: yarn playwright install-deps - name: Run tests shell: bash run: | yarn allure run \ --config=./allurerc.mjs \ --environment=${{ matrix.os }} \ --dump=allure-results-e2e-${{ matrix.os }}-${{ matrix.shard }} \ -- \ yarn vp run -v --filter @allurereport/e2e vp:test --shard "${{ matrix.shard }}/${SHARDS_TOTAL}" - name: Upload test results timeout-minutes: 10 uses: actions/upload-artifact@v7 if: ${{ !cancelled() }} with: name: allure-results-e2e-${{ matrix.os }}-${{ matrix.shard }} path: ./allure-results-e2e-${{ matrix.os }}-${{ matrix.shard }}.zip coverage: needs: [test-packages] name: Upload test coverage runs-on: ubuntu-latest if: ${{ !cancelled() && contains(fromJSON('["success","failure"]'), needs.test-packages.result) }} permissions: contents: read code-quality: write steps: - name: Checkout project uses: actions/checkout@v7 - name: Set up node and install dependencies uses: ./.github/actions/install with: yarn-hardened-mode: "0" - name: Download vitest blob reports uses: actions/download-artifact@v8 continue-on-error: true with: pattern: vitest-blobs-* path: ./ - name: Generate test coverage report env: VITEST_BLOB_PATTERN: "**/.vitest/blob/*.json" run: yarn coverage - name: Publish code coverage uses: clearlyip/code-coverage-report-action@v7 with: filename: packages/common-config/.vitest/coverage/cobertura-coverage.xml badge: true togglable-report: true report-low-coverage-only: true bundle-size: uses: ./.github/workflows/allure-bundle-size.yml report: needs: [lint, test-packages, test-e2e, bundle-size] name: Build report runs-on: ubuntu-latest if: ${{ !cancelled() && contains(fromJSON('["success","failure"]'), needs.test-packages.result) && contains(fromJSON('["success","failure"]'), needs.test-e2e.result) && needs.lint.result != 'failure' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} permissions: actions: read contents: write pull-requests: write checks: write env: ALLURE_QUALITY_GATE: "1" ALLURE_REQUIRE_NEW_TESTS: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'pr:new feature') && '1' || '' }} ALLURE_SERVICE_ACCESS_TOKEN: ${{ secrets.ALLURE_SERVICE_ACCESS_TOKEN }} ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }} ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }} ALLURE_ENDPOINT: ${{ secrets.ALLURE_ENDPOINT }} ALLURE_LAUNCH_TAGS: "${{ secrets.ALLURE_LAUNCH_TAGS }}, ${{ github.event_name }}" ALLURE_PR_TITLE: ${{ github.event.pull_request.title }} steps: - name: Checkout project uses: actions/checkout@v7 - name: Download allure results timeout-minutes: 10 uses: actions/download-artifact@v8 continue-on-error: true with: pattern: allure-results-* path: ./ - name: Download bundle size measurement uses: actions/download-artifact@v8 continue-on-error: true timeout-minutes: 5 with: name: allure-bundle-size-report path: ./allure-bundle-size - name: Build project uses: ./.github/actions/build with: yarn-hardened-mode: "0" - name: Measure report generation env: ALLURE_RESULTS_DIR: ${{ github.workspace }}/allure-perf-probe-results run: yarn workspace @allurereport/core test --config=vitest.perf.config.ts - name: Prepare report metrics run: | mkdir -p ./allure-perf-results cp ./allure-perf-probe-results/*-metric.json ./allure-perf-results/ bundle_metrics=./allure-bundle-size/bundle-size-results/bundle-size-metric.json if [[ -f "$bundle_metrics" ]]; then cp "$bundle_metrics" ./allure-perf-results/ fi - name: Measure CLI and Awesome output sizes continue-on-error: true env: ALLURE_RESULTS_DIR: ${{ github.workspace }}/allure-size-test-results run: | mkdir -p "$ALLURE_RESULTS_DIR" yarn workspace @allurereport/e2e exec playwright test --config=playwright.measurements.config.ts - name: Generate report run: yarn allure generate --config=./allurerc.mjs --dump="allure-results-*/*.zip" ./allure-perf-results ./allure-size-test-results --output=./allure-report - name: Allure Report Official if: ${{ !cancelled() }} uses: allure-framework/allure-action@v0 with: report-directory: "./allure-report" github-token: ${{ secrets.GITHUB_TOKEN }}