Skip to content

Commit

Permalink
Add example warduino test to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tolauwae committed Dec 12, 2024
1 parent 196b962 commit e444f25
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
81 changes: 78 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Tests
on: [ push ]

jobs:
build:
build-wabt:
name: Build WAT tools
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -37,10 +37,45 @@ jobs:
name: wabt-build-${{ github.run_id }}
path: tests/unit/artifacts/wabt/build

build-wdcli:
name: Build WARDuino CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Get WDCLI commit ID
working-directory: tests/unit/artifacts/warduino
run: echo "WDCLI_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Cache WARDuino CLI
uses: actions/cache@v4
id: cache-warduino
with:
key: ${{ runner.os }}-warduino-${{ env.WDCLI_VERSION }}
path: tests/unit/artifacts/warduino
restore-keys: |
${{ runner.os }}-warduino-
- name: Build WARDuino CLI # Build latest version
if: steps.cache-warduino.outputs.cache-hit == false
working-directory: tests/unit/artifacts/warduino
run: |
mkdir build; cd build
cmake .. -D BUILD_EMULATOR=ON
cmake --build .
- name: Upload built tools
uses: actions/upload-artifact@v4
with:
name: warduino-build-${{ github.run_id }}
path: tests/unit/artifacts/warduino/build

unit:
name: Unit tests
runs-on: ubuntu-latest
needs: build
needs: build-wabt
strategy:
fail-fast: false
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -68,10 +103,50 @@ jobs:
env:
WABT: ${GITHUB_WORKSPACE}/.tools

warduino:
name: WARDuino test
runs-on: ubuntu-latest
needs: [build-wabt, build-wdcli]
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: Download WARDuino
uses: actions/download-artifact@v4
with:
name: warduino-build-${{ github.run_id }}
path: .warduino

- name: Verify
run: |
chmod u+x $GITHUB_WORKSPACE/.tools/*
chmod u+x $GITHUB_WORKSPACE/.warduino/wdcli
$GITHUB_WORKSPACE/.tools/wasm-objdump --version
#$GITHUB_WORKSPACE/.warduino/wdcli --version
- name: Run example WARDuino test
run: npm run test:example
env:
WABT: ${GITHUB_WORKSPACE}/.tools
EMULATOR: ${GITHUB_WORKSPACE}/.warduino/wdcli

coverage:
name: Code coverage
runs-on: ubuntu-latest
needs: build
needs: build-wabt
strategy:
fail-fast: true
if: github.event.pull_request.draft == false
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "tests/unit/artifacts/wabt"]
path = tests/unit/artifacts/wabt
url = [email protected]:TOPLLab/wabt.git
[submodule "tests/unit/artifacts/warduino"]
path = tests/unit/artifacts/warduino
url = [email protected]:TOPLLab/WARDuino.git
1 change: 1 addition & 0 deletions tests/unit/artifacts/warduino
Submodule warduino added at 3e97e4

0 comments on commit e444f25

Please sign in to comment.