-
Notifications
You must be signed in to change notification settings - Fork 171
148 lines (143 loc) · 6.1 KB
/
check-staging.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
name: Check Staging
on:
repository_dispatch:
types: [trigger-staging-checks]
workflow_dispatch:
jobs:
cache-pnpm-store:
name: Install everything with PNPM and cache it
secrets: inherit
uses: ./.github/workflows/cache-pnpm-install.yml
take-screenshot:
name: Take Screenshot
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
steps:
- name: Cancel existing runs on this branch
uses: fauguste/[email protected]
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check out the repo
uses: actions/checkout@v2
- 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 Puppeteer Libraries
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Run Puppeteer
id: run-screenshot-test
env:
AWS_S3_BUCKET: ${{secrets.PERFORMANCE_GRAPHS_BUCKET}}
AWS_ACCESS_KEY_ID: ${{ secrets.PERFORMANCE_GRAPHS_ACCESS_KEY}}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PERFORMANCE_GRAPHS_SECRET_KEY }}
AWS_REGION: ${{ secrets.STAGING_BUNDLE_REGION }}
HEADLESS: 'true'
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "cd puppeteer-tests; pnpm install --unsafe-perm; pnpm run screenshot-test"
- name: Build Discord Message
env:
TEMPLATE: >-
[
{
"title": "Staging:",
"color": 2369839,
"image": {
"url": $screenshot_url
}
}
]
SCREENSHOT_URL: ${{ steps.run-screenshot-test.outputs.screenshot }}
run: |
echo "DISCORD_EMBEDS=$(jq -nc --arg screenshot_url "$SCREENSHOT_URL" "$TEMPLATE")" >> $GITHUB_ENV
- name: Send Discord Notification
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Puppeteer'
DISCORD_AVATAR: https://octodex.github.com/images/puppeteer.png
MESSAGE: 'Screenshot of latest Staging deploy'
with:
args: ${{ env.MESSAGE }}
comments-test:
name: Run Comments Tests
timeout-minutes: 12
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
env:
UTOPIA_SHA: ${{ github.sha }}
AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu
AUTH0_ENDPOINT: utopia-staging.us.auth0.com
steps:
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Check out the repo
uses: actions/checkout@v2
- 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: Build Comments Tests
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests"
- name: Run Comments Test
id: run-comments-test
env:
BASE_URL: 'https://utopia.pizza'
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-comments-test"
collaboration-test:
name: Run Collaboration Tests
timeout-minutes: 12
runs-on: ubuntu-latest
needs: [cache-pnpm-store]
env:
UTOPIA_SHA: ${{ github.sha }}
AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu
AUTH0_ENDPOINT: utopia-staging.us.auth0.com
steps:
- name: Install nix
uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz
- name: Check out the repo
uses: actions/checkout@v2
- 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: Build Comments Tests
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests"
- name: Run Comments Test
id: run-comments-test
env:
BASE_URL: 'https://utopia.pizza'
run: |
nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-collaboration-test"
post-failure-to-discord:
name: Post Failure Message To Discord
timeout-minutes: 5
runs-on: ubuntu-latest
if: failure()
needs: [take-screenshot, comments-test, collaboration-test]
steps:
- name: Discord Notification
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
DISCORD_USERNAME: 'Staging Checks Failure'
with:
args: 'Staging checks failed: https://github.com/{{ GITHUB_REPOSITORY }}/actions/runs/{{ GITHUB_RUN_ID }}'