-
Notifications
You must be signed in to change notification settings - Fork 170
174 lines (166 loc) · 6.57 KB
/
master-pushes.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
name: Build And Release On Push To Master
on:
push:
branches: [master]
jobs:
cache-pnpm-store:
name: Install everything with PNPM and cache it
secrets: inherit
uses: ./.github/workflows/cache-pnpm-install.yml
test-editor-code:
name: Test Editor - TypeScript, ESLint, dependency-cruiser
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
env:
UTOPIA_SHA: ${{ github.sha }}
steps:
- name: Cancel existing runs on this branch
uses: fauguste/auto-cancellation-running-action@0.1.4
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check out the repo
uses: actions/checkout@v2
- name: Cache editor test result
id: cache-editor-tests
uses: actions/cache@v2
with:
# For the tests it doesn't really matter what we cache
path: editor/lib
key: ${{ runner.os }}-editor-code-tests-master-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }}
- name: Cache .pnpm-store
uses: actions/cache@v2
with:
path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }}
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Run tsc, eslint, depdendency-cruiser and the website tests
if: steps.cache-editor-tests.outputs.cache-hit != 'true'
run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-code-ci
test-editor-jest:
name: Test Editor - Jest tests
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
env:
UTOPIA_SHA: ${{ github.sha }}
steps:
- name: Cancel existing runs on this branch
uses: fauguste/auto-cancellation-running-action@0.1.4
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check out the repo
uses: actions/checkout@v2
- name: Cache editor test result
id: cache-editor-tests
uses: actions/cache@v2
with:
# For the tests it doesn't really matter what we cache
path: editor/lib
key: ${{ runner.os }}-editor-jest-tests-master-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }}
- name: Cache .pnpm-store
uses: actions/cache@v2
with:
path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }}
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Run the Jest tests
if: steps.cache-editor-tests.outputs.cache-hit != 'true'
run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-jest-ci
call-test-editor-karma-shard-1:
name: Test Editor Shard 1
needs: [cache-pnpm-store]
uses: ./.github/workflows/editor-sharded-tests.yml
secrets: inherit
with:
shard_number: 1
branch: master
pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }}
call-test-editor-karma-shard-2:
name: Test Editor Shard 2
needs: [cache-pnpm-store]
uses: ./.github/workflows/editor-sharded-tests.yml
secrets: inherit
with:
shard_number: 2
branch: master
pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }}
test-server:
name: Test Server
timeout-minutes: 30
runs-on: ubuntu-latest
env:
UTOPIA_SHA: ${{ github.sha }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Cache .cabal/packages
uses: actions/cache@v2
with:
path: .cabal/packages
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages-2
- name: Cache .cabal/store
uses: actions/cache@v2
with:
path: .cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-store-2
- name: Cache dist-newstyle
uses: actions/cache@v2
with:
path: server/dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-server-dist-newstyle-2
- name: Cache server test result
id: cache-server-tests
uses: actions/cache@v2
with:
# For the tests it doesn't really matter what we cache
path: server/src
key: ${{ runner.os }}-server-tests-master-${{ hashFiles('server/src/**') }}-${{ hashFiles('server/test/**') }}-${{ hashFiles('server/cabal.project.freeze') }}
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Start PostgreSQL
run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --arg includeDatabaseSupport true --run start-postgres-background
- name: Run the tests
if: steps.cache-server-tests.outputs.cache-hit != 'true'
run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --run test-server-ci
trigger-deploy:
name: Trigger Deploy
timeout-minutes: 5
needs:
[
test-editor-code,
test-editor-jest,
call-test-editor-karma-shard-1,
call-test-editor-karma-shard-2,
test-server,
]
runs-on: ubuntu-latest
steps:
- name: Use repository dispatch event to trigger deploy
uses: peter-evans/repository-dispatch@v1.1.0
with:
token: ${{ secrets.DEPLOY_REPO_ACCESS_TOKEN }}
repository: concrete-utopia/utopia-deploy
event-type: trigger-deploy
post-failure-to-discord:
name: Post Failure Message To Discord
timeout-minutes: 5
runs-on: ubuntu-latest
if: failure()
needs: [trigger-deploy]
steps:
- name: Discord Notification
uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Build Failure'
with:
args: 'Build failed: https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}'