-
Notifications
You must be signed in to change notification settings - Fork 212
165 lines (157 loc) · 5.28 KB
/
after-merge.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
# Run after merge to trunk
# Note that this relies on branch protection having:
# Require branches to be up to date before merging
on:
push:
branches:
# $default-branch
- master
- 'release-*'
- 'dev-*'
workflow_dispatch:
jobs:
build:
if: ${{ github.repository_owner == 'agoric' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18.x', '20.x']
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: ./.github/actions/restore-node
with:
node-version: ${{ matrix.node-version}}
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
dev-canary:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
# note: only use one node-version
node-version: ['18.x']
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/restore-node
with:
node-version: ${{ matrix.node-version }}
# Adapted from https://johnny.sh/notes/publish-canary-lerna-cicd/
- name: configure NPM token
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: check credentials
run: npm whoami
- name: publish to NPM tag
run: |
case $GITHUB_REF_NAME in
release-*)
# A pre-release.
TAG=${GITHUB_REF_NAME#release-}-dev
;;
dev-*)
# A pre-release while our release branch is straying from master
TAG=${GITHUB_REF_NAME#dev-}-dev
;;
master)
# A trunk dev release.
TAG=dev
;;
*)
# Some other dev release.
TAG=other-dev
;;
esac
# Prevent `lerna publish` from failing due to uncommitted changes.
git stash || true
# without concurrency until https://github.com/Agoric/agoric-sdk/issues/8091
yarn lerna publish --concurrency 1 --conventional-prerelease --canary --exact \
--dist-tag=$TAG --preid=$TAG-$(git rev-parse --short=7 HEAD) \
--no-push --no-verify-access --yes
# restore any stashed changes for caching
git stash pop || true
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
coverage:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
# note: only use one node-version
node-version: ['18.x']
if: ${{github.event_name == 'push' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/restore-node
with:
node-version: ${{ matrix.node-version }}
- name: generate test coverage report
run: ./scripts/ci/generate-test-coverage-report.sh
- uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
- name: Find Netlify site ID
run: |
echo "NETLIFY_SITE_ID=$(cat COVERAGE_NETLIFY_SITE_ID)" >> $GITHUB_ENV
- uses: nwtgck/[email protected]
with:
# Production deployment if a push or merged PR.
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
publish-dir: coverage/html
# SECURITY: we don't want to hand out the Github token to this action.
# github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
benchmark:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
# note: only use one node-version
node-version: ['18.x']
if: ${{github.event_name == 'push'}}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/restore-node
with:
node-version: ${{ matrix.node-version }}
- name: benchmark changes
env:
AUTOBENCH_METRICS_URL: ${{ secrets.AUTOBENCH_METRICS_URL }}
run: cd packages/swingset-runner && yarn ci:autobench
- uses: actions/upload-artifact@v4
with:
name: benchmarkstats.json
path: packages/swingset-runner/benchstats*.json
- name: notify on failure
if: failure()
uses: ./.github/actions/notify-status
with:
from: ${{ secrets.NOTIFY_EMAIL_FROM }}
to: ${{ secrets.NOTIFY_EMAIL_TO }}
password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }}
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}