-
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (142 loc) · 4.66 KB
/
testing.yml
File metadata and controls
163 lines (142 loc) · 4.66 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Testing
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22, 24]
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Enable Corepack
run: corepack enable
- name: Use Node LTS version
uses: actions/setup-node@v6
with:
cache: yarn
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install --immutable
- name: Run test suite
run: yarn test
coverage:
permissions:
pull-requests: write
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24]
steps:
- uses: actions/checkout@v6
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v6
with:
cache: yarn
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install --immutable
- name: Run coverage report
run: yarn coverage
- uses: actions/upload-artifact@v7
with:
name: coverage-data-${{ github.run_id }}
path: |
coverage/**/*.json
- name: Coverage summary
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/cobertura-coverage.xml
format: "markdown"
output: "both"
- name: Add coverage PR comment
uses: marocchino/sticky-pull-request-comment@v3.0.2
with:
recreate: true
path: code-coverage-results.md
- name: Write to job summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
# --- Lint pre-compiled assets for consistency --- #
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
strategy:
matrix:
node-version: [24]
steps:
- name: Check out code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Enable Corepack
run: corepack enable
- name: Use Node LTS version
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: yarn
## --- YARN CACHE --- ##
- name: Check for cached dependencies
continue-on-error: true
id: cache-dependencies
uses: actions/cache@v5
with:
path: |
.cache/yarn
node_modules
key: ubuntu-latest-node${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}
## --- INSTALL --- ##
# If statement isn't needed here b/c yarn will leverage the cache if it exists
- name: Install dependencies
shell: bash
run: yarn install --immutable
- name: Get changed files
id: changed-files
uses: step-security/changed-files@v47
with:
files_yaml: |
eslint:
- '*.js'
mdlint:
- '*.md'
- '!expected/**'
- '!fixtures/**'
- name: Run eslint
uses: reviewdog/action-eslint@v1.34.0
if: ${{ steps.changed-files.outputs.eslint_added_files != '' || steps.changed-files.outputs.eslint_modified_files != '' }}
with:
fail_level: error
level: error
reporter: github-pr-review
filter_mode: diff_context
# eslint_flags: "components/*/stories/*.js"
eslint_flags: "--config ${{ github.workspace }}/.eslintrc ${{ steps.changed-files.outputs.eslint_added_files }} ${{ steps.changed-files.outputs.eslint_modified_files }}"
- name: Run markdownlint on documentation
uses: reviewdog/action-markdownlint@v0.26.2
if: ${{ steps.changed-files.outputs.mdlint_added_files != '' || steps.changed-files.outputs.mdlint_modified_files != '' }}
with:
reporter: github-pr-review
filter_mode: diff_context
fail_level: error
markdownlint_flags: "--config ${{ github.workspace }}/.markdownlint.json ${{ steps.changed-files.outputs.mdlint_added_files }} ${{ steps.changed-files.outputs.mdlint_modified_files }}"
- name: Run lint
run: yarn lint --fix
# This step will evaluate the repo status and report the change
# If there are changes, capture the changes and upload them as an artifact
- name: Check if there are changes
shell: bash
run: |
if [[ -z $(git status --porcelain) ]]; then
echo "No changes detected"
exit 0
else
echo "Changes detected"
git status
git add .
exit 1
fi