-
Notifications
You must be signed in to change notification settings - Fork 24
212 lines (205 loc) · 7.29 KB
/
audits.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Audits
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: examples-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
head-commit:
name: Inspect head commit
runs-on: ubuntu-latest
outputs:
message: ${{ steps.commit.outputs.message }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha || github.sha}}
- name: Inspect
id: commit
run: echo "message=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
javascript:
needs: [head-commit]
if: "${{needs.head-commit.outputs.message != 'docs(examples): converted from e2es'}}"
name: JavaScript
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
workspace:
- apollo-server
- express-graphql
- graph-client
- graphql-helix
- graphql-yoga
- mercurius
env:
PORT: 4000
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
- name: Install
run: yarn install --immutable
- name: Start
run: yarn workspace ${{ matrix.workspace }} start &
- name: Sleep
run: sleep 3
- name: Audit
run: yarn tsx scripts/audit-implementation.ts implementations/${{ matrix.workspace }}
- name: Summary
run: cat implementations/${{ matrix.workspace }}/README.md >> $GITHUB_STEP_SUMMARY
- name: Upload audit report
uses: actions/upload-artifact@v4
with:
name: audit-report-${{ matrix.workspace }}
# > If multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact.
# https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions
#
# Because of this, we include the root README.md to maintain the paths during artifact downloads
path: |
README.md
implementations/${{ matrix.workspace }}/README.md
implementations/${{ matrix.workspace }}/report.json
docker:
needs: [head-commit]
if: "${{needs.head-commit.outputs.message != 'docs(examples): converted from e2es'}}"
name: Docker
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
workspace:
- deno
- hotchocolate
- lighthouse
- postgraphile
# TODO: speed up build process
# - pioneer
env:
PORT: 4000
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
- name: Install
run: yarn install --immutable
- name: Bake
uses: docker/bake-action@v6
with:
workdir: implementations/${{ matrix.workspace }}
source: .
load: true # load image into docker, otherwise `docker compose up` will rebuild
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
- name: Start
run: yarn workspace ${{ matrix.workspace }} start --detach --wait
- name: Audit
run: yarn tsx scripts/audit-implementation.ts implementations/${{ matrix.workspace }}
- name: Summary
run: cat implementations/${{ matrix.workspace }}/README.md >> $GITHUB_STEP_SUMMARY
- name: Upload audit report
uses: actions/upload-artifact@v4
with:
name: audit-report-${{ matrix.workspace }}
# > If multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact.
# https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions
#
# Because of this, we include the root README.md to maintain the paths during artifact downloads
path: |
README.md
implementations/${{ matrix.workspace }}/README.md
implementations/${{ matrix.workspace }}/report.json
url:
needs: [head-commit]
if: "${{needs.head-commit.outputs.message != 'docs(examples): converted from e2es'}}"
name: URL
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
workspace:
- name: thegraph
url: https://api.thegraph.com/subgraphs/name/sushiswap/exchange/graphql
env:
URL: ${{ matrix.workspace.url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
- name: Install
run: yarn install --immutable
- name: Audit
run: yarn tsx scripts/audit-implementation.ts implementations/${{ matrix.workspace.name }}
- name: Summary
run: cat implementations/${{ matrix.workspace.name }}/README.md >> $GITHUB_STEP_SUMMARY
- name: Upload audit report
uses: actions/upload-artifact@v4
with:
name: audit-report-${{ matrix.workspace.name }}
# > If multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact.
# https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions
#
# Because of this, we include the root README.md to maintain the paths during artifact downloads
path: |
README.md
implementations/${{ matrix.workspace.name }}/README.md
implementations/${{ matrix.workspace.name }}/report.json
report:
name: Report
runs-on: ubuntu-latest
needs: [javascript, docker, url]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{secrets.BOT_GITHUB_TOKEN}}
- name: Download audit reports
uses: actions/download-artifact@v4
with:
pattern: audit-report-*
merge-multiple: true
- name: Render servers table
run: node scripts/render-servers-table.mjs
- name: Diff
run: git diff --pretty
- name: Commit
if: github.ref != 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'docs(implementations): audit report'
commit_user_name: theguild-bot
commit_user_email: [email protected]
commit_author: theguild-bot <[email protected]> # dont use the actor as an author
- name: Create PR
if: github.ref == 'refs/heads/main'
uses: peter-evans/create-pull-request@v7
with:
token: ${{secrets.BOT_GITHUB_TOKEN}}
branch: audit-report
title: Audit Report
body: The audit report has changed in ${{github.event.pull_request.head.sha || github.sha}}.
commit-message: 'docs(implementations): audit report'
committer: theguild-bot <[email protected]>
author: theguild-bot <[email protected]> # dont use the actor as an author