forked from compiler-explorer/compiler-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (130 loc) · 4.23 KB
/
test-and-deploy.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
name: Compiler Explorer
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
check-latest: true
cache: npm
- name: Install prerequisites
run: make prereqs
- name: Run checks
run: |
npm run lint-check
npm run ci-test
npm run ts-check
python3 ./etc/scripts/util/propscheck.py
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
build_minimum_support:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18.14.1
uses: actions/setup-node@v4
with:
node-version: 18.14.1
check-latest: false
cache: npm
- name: Install prerequisites
run: make prereqs
- name: Run checks
run: |
npm run ts-compile
npm run webpack
build_dist:
if: github.repository_owner == 'compiler-explorer' && github.event_name == 'push'
runs-on: ubuntu-22.04
outputs:
release_name: ${{ steps.build_dist.outputs.release_name }}
branch: ${{ steps.build_dist.outputs.branch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
check-latest: true
cache: npm
- name: Build distribution
id: build_dist
run: etc/scripts/build-dist.sh
- uses: actions/upload-artifact@v4
with:
name: dist
path: out/dist-bin
deploy:
if: github.repository_owner == 'compiler-explorer' && github.event_name == 'push'
needs: [test, build_dist]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
check-latest: true
cache: npm
- name: Download the built distribution
uses: actions/download-artifact@v4
with:
name: dist
path: out/dist-bin
- name: Unpack static files for sentry
run: |
mkdir -p out/dist/static
tar Jxf out/dist-bin/*.static.tar.xz -C out/dist/static
- name: Tag in sentry
run: |
export SENTRY_AUTH_TOKEN='${{ secrets.SENTRY_AUTH_TOKEN }}'
export SENTRY_DSN='${{ secrets.SENTRY_DSN }}'
export SENTRY_ORG=compiler-explorer
export SENTRY_PROJECT=compiler-explorer
npm run sentry -- releases new -p compiler-explorer "${{ needs.build_dist.outputs.release_name }}"
npm run sentry -- releases set-commits --auto "${{ needs.build_dist.outputs.release_name }}"
npm run sentry -- releases files "${{ needs.build_dist.outputs.release_name }}" upload-sourcemaps out/dist/static
- name: Deploy
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: compiler-explorer
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: out/dist-bin
DEST_DIR: dist/gh/${{ needs.build_dist.outputs.branch }}
- name: Tag the commit
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/gh-${context.runNumber}`,
sha: context.sha
})
post_deploy_check:
needs: [test, build_dist, deploy]
runs-on: [admin]
steps:
- name: Check hashes for deploy ${{ needs.build_dist.outputs.release_name }} to cdn
run: ce --env staging builds check_hashes ${{ needs.build_dist.outputs.release_name }}