build: create build_and_test.yml workflow #7
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: Build and Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install XVFB for testing with VS Code | |
run: | | |
sudo apt-get -y update | |
sudo apt-get -y install --fix-missing xvfb | |
- name: Update rust and install wasm-pack | |
run: | | |
rustup update stable && rustup default stable | |
npm install -g wasm-pack | |
- name: Cache cargo build artifacts | |
# https://doc.rust-lang.org/cargo/guide/build-cache.html | |
uses: actions/cache@v4 | |
with: | |
path: | | |
vscode-cedar-wasm/target | |
key: cargo-build-cache-${{ hashFiles('vscode-cedar-wasm/Cargo.lock') }} | |
- name: Build | |
run: | | |
npm ci | |
npm run wasm-build | |
npm run compile | |
- name: Find VS Code Stable Release | |
id: code-stable | |
run: | | |
echo "VSCODE_VERSION=`curl --silent https://update.code.visualstudio.com/api/releases/stable | jq -r '.[0]'`" >> "$GITHUB_OUTPUT" | |
- name: Cache VSCode Test | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.vscode-test | |
key: vscode-test-cache-${{ steps.code-stable.outputs.VSCODE_VERSION }} | |
- name: Test | |
run: xvfb-run -a npm run test | |
- name: Package | |
run: npm run package | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vsix | |
path: ./*.vsix |