-
-
Notifications
You must be signed in to change notification settings - Fork 3
208 lines (188 loc) · 7.07 KB
/
compiler.yaml
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
name: Compiler
on:
push:
branches: [main]
pull_request:
env:
RUST_BACKTRACE: 1
# Use LLD as the linker to increase compile times. It's installed together
# with LLVM.
RUSTFLAGS: -C link-arg=-fuse-ld=lld
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/[email protected]
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: ./llvm
key: llvm-15.0
- uses: KyleMayes/[email protected]
with:
version: "15.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
# Compiler
- name: "Compiler: clippy"
run: cargo clippy -- --deny warnings
- name: "Compiler: test"
run: cargo test --workspace
- name: "Compiler: fmt"
run: cargo fmt --check
# Core
- name: "Core: run"
run: cargo run --release -- check ./packages/Core/_.candy
# fuzzing:
# name: Fuzzing
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: dsherret/rust-toolchain-file@v1
# - uses: Swatinem/[email protected]
# - name: Cache LLVM and Clang
# id: cache-llvm
# uses: actions/cache@v3
# with:
# path: ./llvm
# key: llvm-15.0
# - uses: KyleMayes/[email protected]
# with:
# version: "15.0"
# cached: ${{ steps.cache-llvm.outputs.cache-hit }}
# - run: cargo run --release -- fuzz ./packages/Benchmark.candy
check-goldens:
name: Check Golden IR Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: candy/
# dsherret/rust-toolchain-file doesn't have an input to specify the
# toolchain file's path.
- run: cp candy/rust-toolchain.toml ./
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/[email protected]
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: ./llvm
key: llvm-15.0
- uses: KyleMayes/[email protected]
with:
version: "15.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Generate Goldens
working-directory: candy/
run: cargo run --release --features inkwell -- debug gold generate ./packages/Examples/
- name: Checkout Golden IRs
uses: actions/checkout@v4
with:
token: ${{ secrets.GOLDEN_IR_PUSH_TOKEN }}
repository: candy-lang/golden-irs
ref: ${{ github.event_name == 'pull_request' && format('{0}_', github.event.pull_request.base.sha) || 'main' }}
fetch-depth: 1
path: golden-irs/
- name: Create new branch in golden-irs/
working-directory: golden-irs/
run: |
git checkout --orphan ${{ github.sha }}_
git rm -r --force .
- run: mv candy/packages/Examples/.goldens/* golden-irs/
- uses: EndBug/[email protected]
with:
cwd: golden-irs/
add: .
message: Generate golden IRs
push: --force origin ${{ github.sha }}_
- id: diff
if: github.event_name == 'pull_request'
continue-on-error: true
working-directory: golden-irs/
run: git diff --quiet ${{ github.event.pull_request.base.sha }}_ ${{ github.sha }}_
- name: Shorten commit SHAs
id: short-shas
if: steps.diff.outcome == 'failure'
run: |
base_sha=${{ github.event.pull_request.base.sha }}
echo "base_sha=${base_sha::7}" >> "$GITHUB_OUTPUT"
head_sha=${{ github.sha }}
echo "head_sha=${head_sha::7}" >> "$GITHUB_OUTPUT"
- if: steps.diff.outcome == 'failure'
uses: peter-evans/[email protected]
with:
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GOLDEN_IR_COMMENT_TOKEN }}
body: |
The golden IRs have changed: [${{ steps.short-shas.outputs.base_sha }}..${{ steps.short-shas.outputs.head_sha }}](https://github.com/candy-lang/golden-irs/compare/${{ github.event.pull_request.base.sha }}_..${{ github.sha }}_)
benchmark:
name: Benchmark
runs-on: ubuntu-latest
# Benchmarks on pushes to main should run sequentially.
concurrency: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && format('{0}-{1}-{2}', github.workflow, github.job, github.ref) || github.run_id }}
steps:
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/[email protected]
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: ./llvm
key: llvm-15.0
- uses: KyleMayes/[email protected]
with:
version: "15.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Run benchmark
working-directory: compiler/vm/
run: cargo bench -- --output-format bencher | tee benchmark_output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Compiler
tool: cargo
output-file-path: compiler/vm/benchmark_output.txt
gh-pages-branch: gh-pages
gh-repository: github.com/candy-lang/benchmark-results
benchmark-data-dir-path: ./
# Only push results to the benchmark repository if we ran on a commit
# to the main branch.
auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
github-token: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.BENCHMARK_RESULTS_TOKEN || secrets.BENCHMARK_RESULTS_COMMENT_TOKEN }}
# Forks don't have access to secrets, so we can't create a commit
# comment. This step can still fail to notify us and the output shows
# results.
comment-always: ${{ github.secret_source == 'Actions' || github.secret_source == 'Dependabot' }}
comment-on-alert: ${{ github.secret_source == 'Actions' || github.secret_source == 'Dependabot' }}
alert-threshold: 200%
# Benchmarks running on GitHub Actions have a very high variance.
fail-on-alert: true
vscode-extension-check:
name: Check VS Code Extension
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
defaults:
run:
working-directory: vscode_extension/
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm install @microsoft/[email protected]
- name: Run ESLint
run: |
npx eslint . \
--ext .ts \
--format @microsoft/eslint-formatter-sarif \
--output-file eslint-results.sarif
continue-on-error: true
- uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: vscode_extension/eslint-results.sarif
wait-for-processing: true