|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | pull_request: |
8 | | -env: |
9 | | - # `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from. |
10 | | - # E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`. |
11 | | - # If, instead, your site lives at the root of the domain, at `https://mydomain.org`, set `BASE_URL=''`. |
12 | | - BASE_URL: '' |
13 | 8 |
|
14 | 9 | jobs: |
15 | | - axe-check: |
| 10 | + check-a11y: |
16 | 11 | runs-on: ubuntu-latest |
17 | 12 | steps: |
18 | | - - name: Checkout code |
19 | | - uses: actions/checkout@v4 |
20 | | - |
21 | | - # 1. Setup Python & Build the Book |
22 | | - - name: Set up Python |
23 | | - uses: actions/setup-python@v4 |
24 | | - with: |
25 | | - python-version: '3.11' |
26 | | - cache: 'pip' |
27 | | - |
28 | | - - name: Install Python dependencies |
29 | | - run: pip install -r requirements.txt |
30 | | - |
31 | | - - name: Build Jupyter Book |
32 | | - run: jupyter-book build --html |
33 | | - |
34 | | - # 2. Setup Node environment for Axe |
35 | | - - name: Setup Node.js |
36 | | - uses: actions/setup-node@v4 |
37 | | - with: |
38 | | - node-version: '20' |
39 | | - |
40 | | - - name: Install Axe CLI and HTTP Server |
41 | | - run: npm install -g @axe-core/cli http-server |
42 | | - |
43 | | - - name: Get Matching Chrome version |
44 | | - run: npx browser-driver-manager install chrome |
45 | | - |
46 | | - # 3. Serve, Discover URLs, and Run Axe |
47 | | - - name: Run Axe Checks |
48 | | - run: | |
49 | | - # B. Start a local server in the background |
50 | | - npx http-server ./_build/html -p 8080 -s & |
51 | | - npx wait-on http://localhost:8080/ |
52 | | - |
53 | | - # C. Generate the URL list from the actual build artifacts |
54 | | - URLS=$(find ./_build/html -name "*.html" -not -path "*/build/*" | sed "s|./_build/html/|http://localhost:8080/|" | tr '\n' ' ') |
55 | | - |
56 | | - # D. Run Axe CLI on the discovered URLs |
57 | | - axe $URLS \ |
58 | | - --tags wcag2a,wcag2aa,wcag21a,wcag21aa \ |
59 | | - --save axe-report.json \ |
60 | | - --exit |
61 | | -
|
62 | | - - name: Upload Accessibility Report |
63 | | - if: always() |
64 | | - uses: actions/upload-artifact@v4 |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Run Accessibility Checks |
| 16 | + uses: berkeley-cdss/myst-a11y@v1 |
65 | 17 | with: |
66 | | - name: axe-report |
67 | | - path: axe-report.json |
| 18 | + exclude: "iframe[src*='youtube.com'], #movie_player" |
0 commit comments