-
-
Notifications
You must be signed in to change notification settings - Fork 644
98 lines (79 loc) · 2.72 KB
/
pr-test-and-lint.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
91
92
93
94
95
96
97
98
name: PR Test & Lint
on:
pull_request:
paths-ignore:
- 'docs/**'
# Ensures that only one deploy task per branch/environment will run at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile --prefer-offline
- name: Cache Manifest
id: destiny-manifest
uses: actions/cache@v4
with:
path: manifest-cache
key: destiny-manifest-${{ github.run_id }}
restore-keys: |
destiny-manifest
- name: Jest Test
run: pnpm test
env:
CLEAN_MANIFEST_CACHE: true
- uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results
path: junit.xml
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Cache ESLint
uses: actions/cache@v4
env:
cache-name: cache-eslint
with:
path: ~/.eslintcache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('.eslintrc') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('.eslintrc') }}
${{ runner.os }}-${{ env.cache-name }}-
- name: Install
run: pnpm install --frozen-lockfile --prefer-offline
- name: Prettier
run: pnpm lint:prettier
- name: StyleLint
run: pnpm lint:stylelint
- name: ESLint (Forked)
if: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
run: pnpm lintcached
- name: Save ESLint Report JSON (Non-Forked)
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
run: pnpm lint-report:cached
continue-on-error: true
- name: Annotate ESLint Results
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
uses: ataylorme/eslint-annotate-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "eslint.results.json"
fail-on-warning: true