Skip to content

Commit dfc1698

Browse files
authored
Merge pull request #5 from DSACMS/add-pr-checks
Add pr checks
2 parents 4d03b16 + f9b318f commit dfc1698

File tree

10 files changed

+8996
-886
lines changed

10 files changed

+8996
-886
lines changed

.github/workflows/checks.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ jobs:
1111
url_to_json: 'https://raw.githubusercontent.com/DSACMS/repo-scaffolder/main/tier3/%7B%7Bcookiecutter.project_slug%7D%7D/repolinter.json'
1212

1313
repolinter-checks:
14+
if: github.event.pull_request.head.repo.full_name == github.repository
1415
name: Tier 3 Checks
1516
needs: resolve-repolinter-json
1617
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
issues: write
1721
env:
1822
RAW_JSON: ${{ needs.resolve-repolinter-json.outputs.raw-json}}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
1925
steps:
2026
- uses: actions/checkout@v4
2127
- run: echo $RAW_JSON > repolinter.json
@@ -39,7 +45,7 @@ jobs:
3945
# non-intrusive notification.
4046
#
4147
# Default: "exit-code"
42-
output_type: 'issue'
48+
output_type: 'exit-code'
4349

4450
# The title to use for the issue created by repolinter-action. This title
4551
# should indicate the purpose of the issue, as well as that it was created by

.github/workflows/pull-request.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: pull request
2+
3+
on: [pull_request]
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
build:
11+
name: build
12+
runs-on: ubuntu-latest
13+
14+
outputs:
15+
cache_key: ${{ steps.cache_key.outputs.cache_key }}
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: recursive
21+
- id: cache_key
22+
run: echo "cache_key=${{ hashFiles('**/**') }}-v1" >> "$GITHUB_OUTPUT"
23+
- uses: actions/cache@v3
24+
id: cache
25+
with:
26+
path: ./app
27+
key: ${{ steps.cache_key.outputs.cache_key }}
28+
- if: steps.cache.outputs.cache-hit != true
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: 18
32+
- if: steps.cache.outputs.cache-hit != true
33+
run: npm install
34+
working-directory: ./app
35+
- if: steps.cache.outputs.cache-hit != true
36+
env:
37+
ELEVENTY_ENV: production
38+
run: npm run build
39+
working-directory: ./app
40+
41+
pa11y-scan:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
with:
46+
submodules: recursive
47+
- name: Use Node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: '18.x'
51+
- name: Install node dependencies
52+
run: npm install
53+
working-directory: ./app
54+
- name: Build site
55+
run: npm run build
56+
working-directory: ./app
57+
- name: Start server in background
58+
run: npx serve dist -l 8080 &
59+
working-directory: ./app
60+
- name: Wait for server
61+
run: sleep 5
62+
- name: Accessibility scan
63+
run: npm run test:pa11y-ci
64+
working-directory: ./app
65+
66+
validate_html:
67+
needs: [build]
68+
name: validate html
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v3
72+
with:
73+
submodules: recursive
74+
- uses: actions/cache/restore@v3
75+
with:
76+
key: ${{ needs.build.outputs.cache_key }}
77+
path: ./app
78+
- uses: actions/setup-node@v3
79+
with:
80+
node-version: 18
81+
- run: npm run test:html-validation
82+
working-directory: ./app
83+
84+
85+
check_links:
86+
needs: [build]
87+
name: Check all links
88+
runs-on: ubuntu-latest
89+
steps:
90+
- uses: actions/checkout@v3
91+
with:
92+
submodules: recursive
93+
- uses: actions/cache/restore@v3
94+
with:
95+
key: ${{ needs.build.outputs.cache_key }}
96+
path: ./app
97+
- uses: actions/setup-node@v3
98+
with:
99+
node-version: 18
100+
- name: Start server in background
101+
run: npx serve dist -l 8080 &
102+
working-directory: ./app
103+
- name: Wait for server
104+
run: sleep 5
105+
- name: Test all links
106+
run: npm run test:links
107+
working-directory: ./app
108+
109+
lint:
110+
name: Run linter
111+
runs-on: ubuntu-latest
112+
steps:
113+
- uses: actions/checkout@v3
114+
with:
115+
submodules: recursive
116+
- name: Use Node
117+
uses: actions/setup-node@v3
118+
with:
119+
node-version: 18
120+
- name: Install node dependencies
121+
run: npm install
122+
working-directory: ./app
123+
- name: Run eslint
124+
run: npm run lint
125+
working-directory: ./app

app/.htmlvalidate.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["html-validate:recommended"],
3+
"rules": {
4+
"void-style": "off",
5+
"no-trailing-whitespace": "off"
6+
}
7+
}

app/.pa11yci.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
defaults: {
3+
concurrency: 1,
4+
standard: "WCAG2AA",
5+
runners: ["htmlcs"],
6+
// ignore iframes because we don't use them and DAP inserts an iframe
7+
// that causes intermittent pa11y errors
8+
hideElements:
9+
"iframe, div[style*='display: none;'], [data-pa11y-ignore], a[href*='/TODO/']",
10+
chromeLaunchConfig: {
11+
executablePath: "/usr/bin/google-chrome"
12+
}
13+
},
14+
urls: [
15+
"http://localhost:8080"
16+
]
17+
}

0 commit comments

Comments
 (0)