|
| 1 | +# Runs on GitHub, where this repository is published. GitLab ignores this file |
| 2 | +# and uses .gitlab-ci.yml; both describe the same checks, so keep them in step. |
| 3 | +# |
| 4 | +# Split in two so a red run says which kind of check broke: "unit" is the fast |
| 5 | +# feedback loop, "integration" drives real browsers, SSR servers and a consumer |
| 6 | +# build. Each job prints its environment first, so a failure log states the |
| 7 | +# runner architecture, Node version and which browser resolved. |
| 8 | +# |
| 9 | +# Not covered here: Safari (needs macOS), screen-reader speech, and complete |
| 10 | +# accessibility conformance. |
| 11 | + |
| 12 | +name: CI |
| 13 | + |
| 14 | +on: |
| 15 | + push: |
| 16 | + branches: [main] |
| 17 | + pull_request: |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + unit: |
| 28 | + name: Unit tests, build and documentation |
| 29 | + runs-on: ubuntu-latest |
| 30 | + timeout-minutes: 15 |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: 22 |
| 36 | + cache: npm |
| 37 | + - name: Print environment |
| 38 | + run: echo "arch=$(uname -m) node=$(node -v) npm=$(npm -v)" |
| 39 | + - name: Resolve a browser |
| 40 | + # @web/test-runner launches Chrome through chrome-launcher, which honours |
| 41 | + # CHROME_PATH. Fail here with the reason rather than inside a test run. |
| 42 | + run: | |
| 43 | + for candidate in "${CHROME_PATH:-}" "$(command -v google-chrome || true)" "$(command -v chromium || true)"; do |
| 44 | + if [ -n "$candidate" ] && [ -x "$candidate" ]; then |
| 45 | + echo "CHROME_PATH=$candidate" >> "$GITHUB_ENV" |
| 46 | + echo "browser: $candidate ($("$candidate" --version 2>&1 | head -1))" |
| 47 | + exit 0 |
| 48 | + fi |
| 49 | + done |
| 50 | + echo "No Chrome or Chromium on this runner; the unit tests need one." >&2 |
| 51 | + exit 1 |
| 52 | + - run: npm ci |
| 53 | + - run: npm test |
| 54 | + - run: npm run build |
| 55 | + - run: npm run test:docs |
| 56 | + |
| 57 | + integration: |
| 58 | + name: Browsers, SSR and Angular AOT |
| 59 | + runs-on: ubuntu-latest |
| 60 | + timeout-minutes: 45 |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + - uses: actions/setup-node@v4 |
| 64 | + with: |
| 65 | + node-version: 22 |
| 66 | + cache: npm |
| 67 | + cache-dependency-path: | |
| 68 | + package-lock.json |
| 69 | + test/ssr/package-lock.json |
| 70 | + test/angular-aot/package-lock.json |
| 71 | + - name: Print environment |
| 72 | + run: echo "arch=$(uname -m) node=$(node -v) npm=$(npm -v)" |
| 73 | + - name: Install CJK fonts |
| 74 | + # Demos and fixtures contain Chinese text; without these fonts the |
| 75 | + # layout and size assertions measure fallback glyphs. |
| 76 | + run: sudo apt-get update -qq && sudo apt-get install -y -qq fonts-noto-cjk > /dev/null |
| 77 | + - run: npm ci |
| 78 | + # Consumers always test a fresh build, so this precedes every check below. |
| 79 | + - run: npm run build |
| 80 | + - run: npm ci --prefix test/ssr |
| 81 | + - name: Install Chrome for Playwright |
| 82 | + # The browser suites request channel 'chrome'; Playwright installs the |
| 83 | + # branded build that channel resolves to. |
| 84 | + run: npm --prefix test/ssr exec -- playwright install --with-deps chrome |
| 85 | + - name: Print browser versions |
| 86 | + run: | |
| 87 | + echo "playwright: $(npm --prefix test/ssr exec -- playwright --version)" |
| 88 | + - run: npm run test:css -- chrome |
| 89 | + - run: npm run test:controls -- chrome |
| 90 | + - run: npm run test:pagination -- chrome |
| 91 | + - run: npm run test:visibility |
| 92 | + - run: npm run test:demo-safety |
| 93 | + - run: npm run test:form-flow |
| 94 | + - run: npm run test:dropdown:chrome |
| 95 | + - run: node test/browser/tree.mjs chrome |
| 96 | + - name: SSR across Next, Nuxt and Angular |
| 97 | + run: npm test --prefix test/ssr |
| 98 | + - run: npm ci --prefix test/angular-aot |
| 99 | + - run: npm run check --prefix test/angular-aot |
| 100 | + - name: Angular AOT consumer runtime |
| 101 | + # preruntime builds the fixture first. |
| 102 | + run: npm run runtime --prefix test/angular-aot |
0 commit comments