Bump @types/vscode from 1.86.0 to 1.89.0 in /vscode_extension #1935
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/rust-cache@v2.7.3 | |
- name: Cache LLVM and Clang | |
id: cache-llvm | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm | |
key: llvm-15.0 | |
- uses: KyleMayes/install-llvm-action@v2.0.1 | |
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/rust-cache@v2.7.3 | |
# - name: Cache LLVM and Clang | |
# id: cache-llvm | |
# uses: actions/cache@v4 | |
# with: | |
# path: ./llvm | |
# key: llvm-15.0 | |
# - uses: KyleMayes/install-llvm-action@v2.0.1 | |
# 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 | |
env: | |
# Counter-intuitively, `github.sha` for a PR event does _not_ refer to the | |
# PR's head SHA, but to a merge commit that GitHub creates behind the | |
# scenes. | |
# | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request | |
# https://fluffyandflakey.blog/2022/12/21/what-is-a-github-pull-request-merge-branch/ | |
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
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/rust-cache@v2.7.3 | |
- name: Cache LLVM and Clang | |
id: cache-llvm | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm | |
key: llvm-15.0 | |
- uses: KyleMayes/install-llvm-action@v2.0.1 | |
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/ | |
lfs: true | |
- name: Create new branch in golden-irs/ | |
working-directory: golden-irs/ | |
run: | | |
git checkout --orphan ${{ env.HEAD_SHA }}_ | |
git rm -r --force . | |
- run: mv candy/packages/Examples/.goldens/* golden-irs/ | |
# GitHub's maximum file size is 100 MB, so we store files larger than that | |
# in Git LFS. We explicitly specify the files to store there so that we | |
# can preview/diff most files normally. | |
- name: Store files larger than 100 MB in LFS | |
working-directory: golden-irs/ | |
run: | | |
large_files=$(find . -type f -size +100M -not -path "./.git/*") | |
if [ -n "$large_files" ]; then | |
while IFS= read -r path; do | |
echo "${path/ /[[:space:]]} filter=lfs diff=lfs merge=lfs -text" >> .gitattributes | |
done <<< "$large_files" | |
fi | |
- uses: EndBug/add-and-commit@v9.1.4 | |
with: | |
cwd: golden-irs/ | |
add: . | |
default_author: user_info | |
message: Generate golden IRs | |
push: --force origin ${{ env.HEAD_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 }}_ ${{ env.HEAD_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=${{ env.HEAD_SHA }} | |
echo "head_sha=${head_sha::7}" >> "$GITHUB_OUTPUT" | |
- if: steps.diff.outcome == 'failure' | |
uses: peter-evans/create-or-update-comment@v4.0.0 | |
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 }}_..${{ env.HEAD_SHA }}_) | |
benchmark: | |
name: Benchmark | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dsherret/rust-toolchain-file@v1 | |
- uses: Swatinem/rust-cache@v2.7.3 | |
- name: Cache cargo plugins | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/bin/ | |
key: ${{ runner.os }}-benchmark-cargo-plugins | |
- name: Cache LLVM and Clang | |
id: cache-llvm | |
uses: actions/cache@v4 | |
with: | |
path: ./llvm | |
key: llvm-15.0 | |
- uses: KyleMayes/install-llvm-action@v2.0.1 | |
with: | |
version: "15.0" | |
cached: ${{ steps.cache-llvm.outputs.cache-hit }} | |
- name: Install Valgrind | |
run: sudo apt update && sudo apt install -y valgrind | |
- name: Install benchmark runner | |
run: | | |
version=$(cargo metadata --format-version=1 | \ | |
jq '.packages[] | select(.name == "iai-callgrind").version' | \ | |
tr -d '"' | |
) | |
# TODO(JonasWanke): Can we avoid the `--force`? Cargo should support | |
# installing it without the flag [0], but it currently fails [1]. | |
# Maybe the cache is missing some files? [2] | |
# [0]: https://github.com/rust-lang/cargo/issues/6727 | |
# [1]: https://github.com/candy-lang/candy/actions/runs/8103066154/job/22146912428?pr=929#step:9:59 | |
# [2]: https://users.rust-lang.org/t/get-cargo-install-to-fail-silently-if-the-binary-already-exists/99507/2 | |
cargo install iai-callgrind-runner --version $version --force | |
- name: Install Bencher CLI | |
uses: bencherdev/bencher@v0.4.2 | |
- name: Run benchmarks and store results | |
working-directory: compiler/vm/ | |
# TODO: Support PRs from forks: https://bencher.dev/docs/how-to/github-actions/#pull-requests-from-forks | |
env: | |
IAI_CALLGRIND_COLOR: never | |
run: | | |
# https://unix.stackexchange.com/a/724034 | |
exec 3>&1 | |
output=$(cargo bench 3>&- | tee /dev/fd/3) | |
exec 3>&- | |
renamed_output=$(echo "$output" | sed -E 's/^benchmark::main::(\S+) .*?:[cv]\("(.*?)"(, & \[("(.*?)"|)\]|)\)$/\1: \2.candy \5/g') | |
bencher run \ | |
--project candy \ | |
--token ${{ secrets.BENCHER_TOKEN }} \ | |
--if-branch ${{ github.head_ref || github.ref_name }} \ | |
--else-if-branch ${{ github.base_ref || 'main' }} \ | |
--else-if-branch main \ | |
--hash ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} \ | |
--testbed github-actions-ubuntu-22-04 \ | |
--adapter rust_iai_callgrind \ | |
--err \ | |
--github-actions ${{ secrets.BENCHMARK_RESULTS_COMMENT_TOKEN }} \ | |
echo "$renamed_output" | |
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/eslint-formatter-sarif@3.0.0 | |
- 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@v3 | |
with: | |
sarif_file: vscode_extension/eslint-results.sarif | |
wait-for-processing: true |