-
Notifications
You must be signed in to change notification settings - Fork 12
90 lines (85 loc) · 3.29 KB
/
axe.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Axe
on:
pull_request_target:
branches: [main]
jobs:
authorize:
environment:
${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true
axe:
needs: authorize
runs-on: ubuntu-latest
env:
PUBLIC_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
PUBLIC_FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
PUBLIC_FIREBASE_STORAGE_BUCKET: ${{secrets.FIREBASE_STORAGE_BUCKET}}
strategy:
matrix:
node-version: ['20.x']
steps:
- uses: actions/github-script@v7
id: pr
with:
script: |
const { data: pullRequest } = await github.rest.pulls.get({
...context.repo,
pull_number: context.payload.pull_request.number,
});
return pullRequest
- uses: actions/checkout@v4
with:
ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install --no-frozen-lockfile
- run: pnpm run build --if-present
- run: pnpm run preview & npx wait-on http://localhost:4321
- run: pnpm install -g @axe-core/cli
- name: Get Chromium version
run: |
CHROMIUM_VERSION=$(wget -qO- https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE | cut -d. -f1)
CHROMEDRIVER_VERSION=$(pnpm view chromedriver version| cut -d. -f1)
echo "Chromium version: $CHROMIUM_VERSION"
echo "Chromedriver version: $CHROMEDRIVER_VERSION"
CHROME_VERSION=$(echo -e "$CHROMIUM_VERSION\n$CHROMEDRIVER_VERSION"| sort -n | head -n 1)
echo "Chrome version that will be used: $CHROME_VERSION"
echo "CHROME_VERSION=$CHROME_VERSION" >> $GITHUB_ENV
- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: ${{ env.CHROME_VERSION }}
- name: Linking Chrome
run: |
rm -f /opt/google/chrome/chrome
ln -s ${{ steps.setup-chrome.outputs.chrome-path }} /opt/google/chrome/chrome
- name: Install chromedriver
run: |
echo "Installing chromedriver version: $CHROME_VERSION"
pnpm install -g chromedriver@$CHROME_VERSION
echo "chromedriver version: $(chromedriver --version)"
- name: Run axe
run: |
CHROMIUM_VERSION=$(google-chrome --version | cut -d' ' -f3 | cut -d'.' -f1)
axe --chromedriver-path $(pnpm root -g)/chromedriver/bin/chromedriver http://localhost:4321 --exit