Enhanced the measure right measuring framework #1735
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: PR Checks | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| NODE_VERSION: "24" | |
| PNPM_VERSION: "10.30.3" | |
| PNPM_HOME: "/home/runner/.local/share/pnpm" | |
| jobs: | |
| setup: | |
| name: Setup | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| pnpm-store-path: ${{ steps.pnpm-store.outputs.path }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Setup PNPM_HOME | |
| run: | | |
| mkdir -p "$PNPM_HOME" | |
| echo "$PNPM_HOME" >> $GITHUB_PATH | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| - name: Cache pnpm store | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - name: Install One Play | |
| run: pnpm install -g @1771technologies/oneplay@0.0.5 --ignore-workspace | |
| - name: Install Dependencies | |
| run: op np i | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Setup PNPM_HOME | |
| run: | | |
| mkdir -p "$PNPM_HOME" | |
| echo "$PNPM_HOME" >> $GITHUB_PATH | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.setup.outputs.pnpm-store-path }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - run: pnpm install -g @1771technologies/oneplay@0.0.5 --ignore-workspace | |
| - run: op np i | |
| - name: Lint All Packages | |
| run: op np --filter './packages/*' --filter '!./packages/sample-data' exec op lint | |
| fmt: | |
| name: Format | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Setup PNPM_HOME | |
| run: | | |
| mkdir -p "$PNPM_HOME" | |
| echo "$PNPM_HOME" >> $GITHUB_PATH | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.setup.outputs.pnpm-store-path }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - run: pnpm install -g @1771technologies/oneplay@0.0.5 --ignore-workspace | |
| - run: op np i | |
| - name: Check All Packages Format | |
| run: op np --filter './packages/*' exec op fmt | |
| typecheck: | |
| name: Typecheck | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Setup PNPM_HOME | |
| run: | | |
| mkdir -p "$PNPM_HOME" | |
| echo "$PNPM_HOME" >> $GITHUB_PATH | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.setup.outputs.pnpm-store-path }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - run: pnpm install -g @1771technologies/oneplay@0.0.5 --ignore-workspace | |
| - run: op np i | |
| - name: Typecheck All Packages | |
| run: op np --filter './packages/*' exec op typecheck | |
| packages-matrix: | |
| name: Compute package matrix | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| packages: ${{ steps.gen.outputs.packages }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Generate packages JSON (changed-only for PRs) | |
| id: gen | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| base="${{ github.event.pull_request.base.sha }}" | |
| head="${{ github.event.pull_request.head.sha }}" | |
| else | |
| base="${{ github.event.before }}" | |
| head="${{ github.sha }}" | |
| fi | |
| echo "Diffing changes from $base to $head" | |
| all_pkgs=$( | |
| find packages -mindepth 1 -maxdepth 1 -type d \ | |
| ! -name "sample-data" \ | |
| -print | sort | |
| ) | |
| if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| echo "Push to main detected → running ALL packages." | |
| pkgs="$all_pkgs" | |
| else | |
| changed_files=$(git diff --name-only "$base" "$head" || true) | |
| echo "Changed files:" | |
| echo "$changed_files" | |
| root_file_changed=$( | |
| printf '%s\n' "$changed_files" \ | |
| | awk ' | |
| NF==0 {next} | |
| $0 !~ /\// {print; exit 0} | |
| ' || true | |
| ) | |
| if [[ -n "$root_file_changed" ]]; then | |
| echo "Root file change detected (example: $root_file_changed) → running ALL packages." | |
| pkgs="$all_pkgs" | |
| else | |
| echo "No root files changed → running ONLY changed packages." | |
| changed_pkgs=$( | |
| printf '%s\n' "$changed_files" \ | |
| | awk -F/ '$1=="packages" && $2!="" { print "packages/"$2 }' \ | |
| | sort -u \ | |
| | while read -r p; do | |
| if [[ -d "$p" && "$(basename "$p")" != "sample-data" ]]; then | |
| echo "$p" | |
| fi | |
| done | |
| ) | |
| if [[ -z "${changed_pkgs// }" ]]; then | |
| echo "No package changes found under packages/ → outputting empty package matrix." | |
| pkgs="" | |
| else | |
| pkgs="$changed_pkgs" | |
| fi | |
| fi | |
| fi | |
| if [[ -z "${pkgs// }" ]]; then | |
| json="" | |
| else | |
| json=$( | |
| while IFS= read -r p; do | |
| [[ -z "$p" ]] && continue | |
| name="${p#packages/}" | |
| pretty="${name//commercial-/}" | |
| pretty="${pretty//-/ }" | |
| pretty="${pretty//_/ }" | |
| pretty="$(echo "$pretty" | awk '{ for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) } print }')" | |
| jq -n --arg path "$p" --arg name "$name" --arg display "$pretty" \ | |
| '{path:$path,name:$name,display:$display}' | |
| done <<< "$pkgs" | jq -cs . | |
| ) | |
| fi | |
| echo "Final package matrix: $json" | |
| { | |
| echo "packages<<EOF" | |
| echo "$json" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| test: | |
| if: ${{ needs.packages-matrix.outputs.packages != '' }} | |
| name: >- | |
| ${{ | |
| (matrix.browser == 'chrome' && 'Chrome') || | |
| (matrix.browser == 'firefox' && 'Firefox') || | |
| (matrix.browser == 'safari' && 'Safari') || | |
| matrix.browser | |
| }} | ${{ matrix.package.display }} | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - setup | |
| - packages-matrix | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 24 | |
| matrix: | |
| browser: | |
| - chrome | |
| - firefox | |
| - safari | |
| package: ${{ fromJson(needs.packages-matrix.outputs.packages) }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Setup PNPM_HOME | |
| run: | | |
| mkdir -p "$PNPM_HOME" | |
| echo "$PNPM_HOME" >> $GITHUB_PATH | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.setup.outputs.pnpm-store-path }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - run: pnpm install -g @1771technologies/oneplay@0.0.5 --ignore-workspace | |
| - run: op np i | |
| - name: Install Playwright Binaries (${{ matrix.browser }}) | |
| shell: bash | |
| run: | | |
| case "${{ matrix.browser }}" in | |
| chrome) npx playwright install --with-deps chromium ;; | |
| firefox) npx playwright install --with-deps firefox ;; | |
| safari) npx playwright install --with-deps webkit ;; | |
| *) echo "Unknown browser: ${{ matrix.browser }}" && exit 1 ;; | |
| esac | |
| - name: Run tests | |
| working-directory: ${{ matrix.package.path }} | |
| run: op test run --project=${{ matrix.browser }} | |
| - name: Upload screenshots (on failure) | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: failed-screenshots-${{ matrix.package.name }}-${{ matrix.browser }}-${{ github.run_number }} | |
| path: | | |
| **/__screenshots__/** | |
| if-no-files-found: ignore | |
| retention-days: 1 | |
| build: | |
| name: Build | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| lfs: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Setup PNPM_HOME | |
| run: | | |
| mkdir -p "$PNPM_HOME" | |
| echo "$PNPM_HOME" >> $GITHUB_PATH | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.setup.outputs.pnpm-store-path }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| - run: pnpm install -g @1771technologies/oneplay@0.0.5 --ignore-workspace | |
| - run: op np i | |
| - name: Build All Packages | |
| run: op np --filter './packages/*' exec op compile |