-
Notifications
You must be signed in to change notification settings - Fork 4
177 lines (150 loc) · 4.77 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI
on:
push:
branches-ignore: [ master ]
pull_request:
branches: [ 'master', 'development' ]
types: [
opened,
synchronize,
reopened ]
workflow_dispatch:
inputs:
Name:
description: 'A name for this re-run'
required: true
default: 'Re-run the workflow'
Description:
description: 'A description for this re-run'
required: false
default: ''
jobs:
Check-Duplicate:
runs-on: windows-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
skip_after_successful_duplicate: 'true'
concurrent_skipping: 'same_content_newer'
cancel_others: 'true'
CI-Build:
needs: Check-Duplicate
if: ${{ needs.Check-Duplicate.outputs.should_skip != 'true' }}
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: Output commit message
run: echo "${{ github.event.head_commit.message }}"
# Retrieve gatsby cache
# Creates new cache when OS/run_id changes
# Skip if the commit message contains text 'skip cache'
- name: Gatsby Cache
if: "!contains(github.event.head_commit.message, 'skip cache')"
id: gatsby-ci-cache
uses: actions/cache@v4
with:
path: |
public
.cache
key: ${{ runner.os }}-gatsby-ci-${{ github.run_id }}
restore-keys: ${{ runner.os }}-gatsby-ci-
- name: Install playwright dependencies
uses: microsoft/playwright-github-action@v1
- name: Install dependencies
run: npm ci --legacy-peer-deps
# Enable incremental build
- name: Incremental build
run: npm run build:noGA
env:
NODE_OPTIONS: "--max-old-space-size=8192"
EVENT_API_KEY_1: ${{ secrets.EVENT_API_KEY_1 }}
EVENT_API_KEY_2: ${{ secrets.EVENT_API_KEY_2 }}
EVENT_ORG_ID_1: ${{ secrets.EVENT_ORG_ID_1 }}
EVENT_ORG_ID_2: ${{ secrets.EVENT_ORG_ID_2 }}
GATSBY_GH_APP_GITALK_ID: ${{ secrets.GATSBY_GH_APP_GITALK_ID }}
GATSBY_GH_APP_GITALK_SECRET: ${{ secrets.GATSBY_GH_APP_GITALK_SECRET }}
GATSBY_ENV: ${{ secrets.GATSBY_ENV }}
- name: Zip artifact for test
run: 7z a -t7z e2e.7z ./public/ -r
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: repo-artifact
path: e2e.7z
retention-days: 1
E2E-Test:
needs: CI-Build
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
# Retrieve gatsby cache
# Creates new cache when OS/run_id changes
# Skip if the commit message contains text 'skip cache'
- name: Gatsby Cache
if: "!contains(github.event.head_commit.message, 'skip cache')"
id: gatsby-ci-cache
uses: actions/cache@v3
with:
path: |
public
.cache
key: ${{ runner.os }}-gatsby-ci-${{ github.run_id }}
restore-keys: ${{ runner.os }}-gatsby-ci-
- name: Install playwright dependencies
uses: microsoft/playwright-github-action@v1
- name: Install dependencies
run: npm ci --legacy-peer-deps
- uses: actions/download-artifact@v4
with:
name: repo-artifact
- name: unzip artifact
run: 7z x e2e.7z -aoa
- name: Serve and E2E test
run: npm run serve & npm run test:e2e; tskill node
Test:
needs: Check-Duplicate
if: ${{ needs.Check-Duplicate.outputs.should_skip != 'true' }}
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- name: Install playwright dependencies
uses: microsoft/playwright-github-action@v1
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Jest cache
id: gatsby-jest-cache
uses: actions/cache@v3
with:
path: .jest-cache
key: ${{ runner.os }}-jestCache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-jestCache-
- name: tests
run: npm run test