-
-
Notifications
You must be signed in to change notification settings - Fork 10
154 lines (144 loc) · 4.39 KB
/
ci.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
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
name: 'CI'
on:
push:
branches:
- main
pull_request:
branches:
- '**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLIC_TYPEKIT_ID: ${{ secrets.GATSBY_TYPEKIT_ID }}
PUBLIC_MAPBOX_ACCESS_TOKEN: ${{ secrets.GATSBY_MAPBOX_ACCESS_TOKEN }}
PUBLIC_UMAMI_SCRIPT_URL: ${{ secrets.GATSBY_UMAMI_SCRIPT_URL }}
PUBLIC_UMAMI_WEBSITE_ID: ${{ secrets.GATSBY_UMAMI_WEBSITE_ID }}
PUBLIC_INFURA_ID: ${{ secrets.GATSBY_INFURA_ID }}
PUBLIC_WALLETCONNECT_ID: ${{ secrets.GATSBY_WALLETCONNECT_ID }}
PUBLIC_WEB3_API_URL: ${{ secrets.PUBLIC_WEB3_API_URL }}
jobs:
lint:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: ['20']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npm run lint
typecheck:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: ['20']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npm run prebuild
- run: npm run typecheck
test-unit:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: ['20']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npm run test:unit
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.node == '20'
with:
name: coverage-${{ matrix.os }}-${{ matrix.node }}
path: coverage/
test-e2e:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: ['20']
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm ci
- run: npx playwright install --with-deps
- run: npm run test:e2e
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
node: ['20']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Cache Astro build output
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.astro
key: ${{ matrix.os }}-${{ matrix.node }}-astro-build-${{ hashFiles('content/**/*.jpg', 'content/**/*.png') }}
restore-keys: ${{ matrix.os }}-${{ matrix.node }}-astro-build-
- run: npm ci
- run: NODE_OPTIONS="--max-old-space-size=4096" npm run build
- name: Zip artifact for deployment
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest' && matrix.node == '20'
run: zip dist.zip ./dist -r
- uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest' && matrix.node == '20'
with:
name: dist-${{ matrix.os }}-${{ matrix.node }}
path: dist.zip
coverage:
runs-on: ubuntu-latest
needs: [test-unit]
if: ${{ success() && github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage-ubuntu-latest-20
- uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
deploy:
needs: [lint, typecheck, test-unit, test-e2e, build]
if: success() && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: dist-ubuntu-latest-20
- name: unzip artifact
run: unzip dist.zip
- name: Deploy to S3
run: npm run deploy:s3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}