name: A11y Tests on: pull_request: types: [labeled, opened, synchronize, reopened] workflow_dispatch: jobs: a11y-test: name: Run A11y Tests if: contains(github.event.pull_request.labels.*.name, 'a11y-tests') runs-on: ${{ fromJSON(vars.RUNNER) }} timeout-minutes: 40 steps: - uses: browser-actions/setup-chrome@2e1d749697dd1612b833dba4a722266286fbefcd # v2.1.2 with: install-dependencies: true - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 24 - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 #v6.0.8 with: cache: true cache_dependency_path: '**/pnpm-lock.yaml' run_install: false - run: pnpm install - name: Run a11y tests env: # this will generate the test reports but causes tests to pass even when there a11y failures ENABLE_A11Y_MIDDLEWARE_REPORTER: true run: pnpm test-a11y - name: Consolidate ember a11y reports run: | mkdir ember-a11y-reports jq -s 'map(.[])' ./ui/admin/ember-a11y-report/*.json > ember-a11y-reports/admin.json jq -s 'map(.[])' ./ui/desktop/ember-a11y-report/*.json > ember-a11y-reports/desktop.json - name: Output ember a11y test report summary (admin) run: 'cat ember-a11y-reports/admin.json | jq "map({moduleName,testName,routes,urls,violations: .violations | map({id, nodes: .nodes | map({failureSummary, targets: .[].[]?.relatedNodes?.[]?.target? })}) })"' - name: Output ember a11y test report summary (desktop) run: 'cat ember-a11y-reports/desktop.json | jq "map({moduleName,testName,routes,urls,violations: .violations | map({id, nodes: .nodes | map({failureSummary, targets: .[].[]?.relatedNodes?.[]?.target? })}) })"' - name: Upload ember a11y reports uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ember-a11y-reports path: ./ember-a11y-reports - name: Report a11y test results status if: always() # fail CI when the combined array length of admin and desktop a11y reports is not 0 run: | EMBER_A11Y_FAILURE_COUNT=$(jq -s 'map(.[]) | length' ember-a11y-reports/admin.json ember-a11y-reports/desktop.json) echo "$EMBER_A11Y_FAILURE_COUNT ember-a11y test failures" if [ "$EMBER_A11Y_FAILURE_COUNT" != '0' ]; then exit 1 fi