Skip to content

fixup! Build WAT tools #44

fixup! Build WAT tools

fixup! Build WAT tools #44

Workflow file for this run

name: Tests
on: [ push ]
jobs:
build:
name: Build WAT tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get WABT commit ID
working-directory: tests/unit/artifacts/wabt
run: echo "WABT_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Cache wabt
uses: actions/cache@v4
id: cache-wabt
with:
key: ${{ runner.os }}-wabt-${{ env.WABT_VERSION }}
path: tests/unit/artifacts/wabt
restore-keys: |
${{ runner.os }}-wabt-
- name: Build WABT # Build latest version
if: steps.cache-wabt.outputs.cache-hit == false
working-directory: tests/unit/artifacts/wabt
run: |
mkdir build; cd build
cmake ..
cmake --build .
- name: Upload built tools
uses: actions/upload-artifact@v4
with:
name: wabt-build-${{ github.run_id }}
path: tests/unit/artifacts/wabt/build
unit:
name: Unit tests
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild files
run: npm run test:prebuild
- name: Download WAT tools
uses: actions/download-artifact@v4
with:
name: wabt-build-${{ github.run_id }}
path: .tools
- name: Verify tools
run: |
chmod u+x $GITHUB_WORKSPACE/.tools/*
$GITHUB_WORKSPACE/.tools/wasm-objdump --version
- name: Run ava unit tests
run: npm run test:ava
env:
WABT: ${GITHUB_WORKSPACE}/.tools
coverage:
name: Code coverage
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: true
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- run: npm i
- name: Prebuild files
run: npm run test:prebuild
- name: Download WAT tools
uses: actions/download-artifact@v4
with:
name: wabt-build-${{ github.run_id }}
path: .tools
- name: Verify tools
run: |
chmod u+x $GITHUB_WORKSPACE/.tools/*
$GITHUB_WORKSPACE/.tools/wasm-objdump --version
- name: Add .tools to PATH
run: echo "$GITHUB_WORKSPACE/.tools" >> $GITHUB_PATH
- name: Run c8 coverage
run: |
echo "LINE_COVERAGE=$(npm run coverage:test:ava | grep -E '^\s*Lines\s*:\s*[0-9]+(\.[0-9]+)?%' | awk '{print $3}' | tr -d '%')" >> $GITHUB_ENV
- name: Report coverage
run: npx c8 report
- name: Update coverage badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 615b7906cd71effb447c4b08673d2cb6
filename: latch-coverage.json
label: Coverage
message: ${{ env.LINE_COVERAGE }}
valColorRange: ${{ env.LINE_COVERAGE }}
maxColorRange: 100
minColorRange: 0