forked from concrete-utopia/utopia
105 lines (102 loc) · 4.22 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
name: Build And Release On Push To Master
on:
push:
branches: [master]
jobs:
test-editor:
name: Test Editor
runs-on: ubuntu-latest
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 .pnpm-store
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- 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-tests-master-2-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('utopia-vscode-common/src/**')}}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }}
- 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 tests
if: steps.cache-editor-tests.outputs.cache-hit != 'true'
run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-all-ci
- name: Discord Notification
uses: Ilshidur/action-discord@0.3.2
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Build Failure'
with:
args: 'Editor Tests Failed: https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}'
test-server:
name: Test Server
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
- name: Discord Notification
uses: Ilshidur/action-discord@0.3.2
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Build Failure'
with:
args: 'Server Tests Failed: https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}'
trigger-deploy:
name: Trigger Deploy
needs: [test-editor, 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