-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
114 lines (100 loc) · 3.73 KB
/
test.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Build, Lint, and Test
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
job_build:
name: Build
runs-on: ubuntu-latest
env:
JEKYLL_ENABLE_PLATFORM_API: false
steps:
- uses: actions/checkout@v2
- uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
- uses: actions/cache@v3
id: cache
with:
path: ${{ github.workspace }}/node_modules
key: node-${{ runner.os }}-${{ hashfiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'
- uses: actions/cache@v3
with:
path: |
.cache
public
key: node-${{ runner.os }}-${{ hashfiles('**/yarn.lock') }}-gatsby-build
- name: yarn build
run: yarn build
- run: yarn lint:links
job_lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Internal github app token
id: token
uses: getsentry/action-github-app-token@97c9e23528286821f97fba885c1b1123284b29cc # v2.0.0
continue-on-error: true
with:
app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
- uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
- uses: actions/cache@v3
id: cache
with:
path: ${{ github.workspace }}/node_modules
key: node-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'
# Additional checks
- run: yarn lint:ts
- run: yarn lint:docs
# Run automatic fixes (run prettier apart from eslint to also fix mdx files)
- run: yarn lint:prettier:fix
- run: yarn lint:eslint:fix
# Check (and error) for dirty working tree for forks
# Reason being we need a different token to auto commit changes and
# forks do not have access to said token
- name: Check for dirty git working tree (forks)
if: steps.token.outcome != 'success' && github.ref != 'refs/heads/master'
run: |
git diff --quiet || (echo '::error ::lint produced file changes, run linter locally and try again' && exit 1)
# If working tree is dirty, commit and update if we have a token
- name: Commit any eslint fixed files
if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master'
uses: getsentry/action-github-commit@748c31dd78cffe76f51bef49a0be856b6effeda7 # main
with:
github-token: ${{ steps.token.outputs.token }}
job_test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
- uses: actions/cache@v3
id: cache
with:
path: ${{ github.workspace }}/node_modules
key: node-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'
- name: Run Tests
run: yarn test
job_test_build:
name: Build (env=test)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
- uses: actions/cache@v3
id: cache
with:
path: ${{ github.workspace }}/node_modules
key: node-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true'
- name: Build
run: yarn build:test