fix: make CI case results reliable and restore ARM64 validation (#630) #56
This file contains hidden or 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: Wave Cases | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_BUILD_JOBS: "2" | |
| LLVM_MINGW_VERSION: "20251216" | |
| LLVM_MINGW_SHA256: "c892f0155c2201c43257b2c5d1e12b899229d8dc957aa3e5937ce00e3ca09e91" | |
| LLVM_MINGW_ARM64_SHA256: "60c06bd255feb2ef1eb6fce7ee6b307d8f78ee6639660f49861c7c10a8a86164" | |
| LLVM_WINDOWS_ARM64_VERSION: "21.1.8" | |
| LLVM_WINDOWS_ARM64_SHA256: "f214b1226d8de005b5f691dd29d9dfea2b49e22d0de445429916173dbb626f7f" | |
| LOONGARCH_TOOLCHAIN_VERSION: "2025.08.08" | |
| LOONGARCH_TOOLCHAIN_ARCHIVE: "x86_64-cross-tools-loongarch64-binutils_2.45-gcc_15.1.0-glibc_2.42.tar.xz" | |
| LOONGARCH_TOOLCHAIN_SHA256: "b8572e2083143ff1807658f02e11eba53e5ed81d6194854d369b43fceea72de7" | |
| PYTHONUNBUFFERED: "1" | |
| PYTHONUTF8: "1" | |
| PYTHONIOENCODING: "utf-8" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: wave-cases-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| case-config: | |
| name: Validate case matrix | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| linux: ${{ steps.matrix.outputs.linux }} | |
| macos: ${{ steps.matrix.outputs.macos }} | |
| windows: ${{ steps.matrix.outputs.windows }} | |
| windows_arm64: ${{ steps.matrix.outputs.windows_arm64 }} | |
| cross: ${{ steps.matrix.outputs.cross }} | |
| qemu: ${{ steps.matrix.outputs.qemu }} | |
| loongarch: ${{ steps.matrix.outputs.loongarch }} | |
| wasm: ${{ steps.matrix.outputs.wasm }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Validate manifest and generate matrices | |
| id: matrix | |
| run: | | |
| python3 -m py_compile tools/case_manifest.py tools/populate_case_matrix.py tools/check_freebsd_sys.py | |
| python3 tools/case_manifest.py validate | |
| python3 tools/case_manifest.py github-output >> "$GITHUB_OUTPUT" | |
| cases-linux: | |
| name: Cases Linux ${{ matrix.arch }} | |
| needs: case-config | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.linux) }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 35 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install LLVM 21 and LLD | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y wget software-properties-common | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 21 | |
| sudo apt-get install -y lld-21 | |
| echo "LLVM_SYS_211_PREFIX=/usr/lib/llvm-21" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=/usr/lib/llvm-21/bin/llvm-config" >> "$GITHUB_ENV" | |
| echo "/usr/lib/llvm-21/bin" >> "$GITHUB_PATH" | |
| - name: Install Wave standard library | |
| id: install_std | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Build release compiler | |
| id: build_compiler | |
| run: cargo build --locked --release --jobs 2 | |
| - name: Check every target case | |
| if: ${{ matrix.id == 'linux-amd64' }} | |
| run: >- | |
| python3 tools/check_case_sources.py --wavec target/release/wavec | |
| --report-json wave-source-checks.json | |
| - name: Upload source check report | |
| if: ${{ always() && matrix.id == 'linux-amd64' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-source-checks | |
| path: wave-source-checks.json | |
| if-no-files-found: warn | |
| - name: Run all Wave cases | |
| if: ${{ !cancelled() && steps.install_std.outcome == 'success' && steps.build_compiler.outcome == 'success' }} | |
| run: >- | |
| python3 tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}.json | |
| - name: Upload case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}.json | |
| if-no-files-found: warn | |
| cases-macos: | |
| name: Cases macOS ${{ matrix.arch }} | |
| needs: case-config | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.macos) }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install LLVM 21 and LLD | |
| run: brew install llvm@21 lld | |
| - name: Configure LLVM | |
| run: | | |
| llvm_prefix="$(brew --prefix llvm@21)" | |
| lld_prefix="$(brew --prefix lld)" | |
| echo "LLVM_SYS_211_PREFIX=$llvm_prefix" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=$llvm_prefix/bin/llvm-config" >> "$GITHUB_ENV" | |
| echo "$llvm_prefix/bin" >> "$GITHUB_PATH" | |
| echo "$lld_prefix/bin" >> "$GITHUB_PATH" | |
| echo "WAVE_LD64_LLD=$lld_prefix/bin/ld64.lld" >> "$GITHUB_ENV" | |
| - name: Install Wave standard library | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Build release compiler | |
| run: cargo build --locked --release --jobs 2 | |
| - name: Run all Wave cases | |
| run: >- | |
| python3 tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}.json | |
| - name: Upload case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}.json | |
| if-no-files-found: warn | |
| cases-windows: | |
| name: Cases Windows GNU ${{ matrix.arch }} | |
| needs: case-config | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.windows) }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 50 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| path-type: inherit | |
| install: >- | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-python | |
| mingw-w64-x86_64-libffi | |
| mingw-w64-x86_64-zstd | |
| mingw-w64-x86_64-zlib | |
| - name: Install pinned LLVM 21 and LLD | |
| shell: msys2 {0} | |
| run: | | |
| set -euo pipefail | |
| pacman --noconfirm -U \ | |
| https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-llvm-21-21.1.8-5-any.pkg.tar.zst \ | |
| https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-lld-21-21.1.8-5-any.pkg.tar.zst | |
| - name: Install Rust GNU toolchain | |
| shell: msys2 {0} | |
| run: | | |
| set -euo pipefail | |
| rustup toolchain install 1.89.0-x86_64-pc-windows-gnu --profile minimal --force-non-host | |
| rustup target add x86_64-pc-windows-gnu --toolchain 1.89.0-x86_64-pc-windows-gnu | |
| rustup default 1.89.0-x86_64-pc-windows-gnu | |
| - name: Configure Windows LLVM and MinGW runtime | |
| shell: msys2 {0} | |
| run: | | |
| set -euo pipefail | |
| llvm_root="$(cygpath -w /mingw64/opt/llvm-21)" | |
| llvm_bin="$(cygpath -w /mingw64/opt/llvm-21/bin)" | |
| llvm_config="$(cygpath -w /mingw64/opt/llvm-21/bin/llvm-config.exe)" | |
| mingw_bin="$(cygpath -w /mingw64/bin)" | |
| mingw_lib="$(cygpath -w /mingw64/lib)" | |
| mingw_pkgconfig="$(cygpath -w /mingw64/lib/pkgconfig)" | |
| rust_sysroot="$(rustc --print sysroot)" | |
| rust_target_lib="$rust_sysroot/lib/rustlib/x86_64-pc-windows-gnu/lib" | |
| crt2_path="$(find "$rust_target_lib" -name crt2.o -print -quit)" | |
| test -n "$crt2_path" | |
| rust_mingw_self="$(dirname "$crt2_path")" | |
| echo "WAVE_LLVM_HOME=$llvm_root" >> "$GITHUB_ENV" | |
| echo "WAVE_WINDOWS_LLVM_BIN=$llvm_bin" >> "$GITHUB_ENV" | |
| echo "LLVM_SYS_211_PREFIX=$llvm_root" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=$llvm_config" >> "$GITHUB_ENV" | |
| echo "WAVE_WINDOWS_MINGW_LIB=$(cygpath -w "$rust_mingw_self")" >> "$GITHUB_ENV" | |
| echo "$llvm_bin" >> "$GITHUB_PATH" | |
| echo "$mingw_bin" >> "$GITHUB_PATH" | |
| echo "$(cygpath -w /usr/bin)" >> "$GITHUB_PATH" | |
| echo "LIBRARY_PATH=$mingw_lib" >> "$GITHUB_ENV" | |
| echo "PKG_CONFIG_PATH=$mingw_pkgconfig" >> "$GITHUB_ENV" | |
| echo "RUSTFLAGS=-Lnative=$mingw_lib -lffi -lzstd -lz" >> "$GITHUB_ENV" | |
| - name: Install Wave standard library | |
| shell: msys2 {0} | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Build release compiler | |
| shell: msys2 {0} | |
| run: >- | |
| cargo build --locked --release --no-default-features | |
| --features llvm-target-core64 --jobs 2 | |
| - name: Run all Wave cases | |
| shell: msys2 {0} | |
| run: >- | |
| python tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}.json | |
| - name: Upload case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}.json | |
| if-no-files-found: warn | |
| cases-windows-arm64: | |
| name: Cases Windows GNU ${{ matrix.arch }} | |
| needs: case-config | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.windows_arm64) }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install pinned native LLVM 21 and llvm-mingw | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $llvmArchive = Join-Path $env:RUNNER_TEMP "llvm-arm64.tar.xz" | |
| $llvmDirectory = Join-Path $env:RUNNER_TEMP "llvm-arm64" | |
| $llvmUrl = "https://github.com/llvm/llvm-project/releases/download/llvmorg-$env:LLVM_WINDOWS_ARM64_VERSION/clang%2Bllvm-$env:LLVM_WINDOWS_ARM64_VERSION-aarch64-pc-windows-msvc.tar.xz" | |
| curl.exe --fail --location --retry 3 $llvmUrl --output $llvmArchive | |
| if ((Get-FileHash $llvmArchive -Algorithm SHA256).Hash.ToLowerInvariant() -ne $env:LLVM_WINDOWS_ARM64_SHA256) { | |
| throw "LLVM ARM64 archive checksum mismatch" | |
| } | |
| New-Item -ItemType Directory -Force -Path $llvmDirectory | Out-Null | |
| tar.exe -xJf $llvmArchive --strip-components=1 -C $llvmDirectory | |
| $mingwArchive = Join-Path $env:RUNNER_TEMP "llvm-mingw-arm64.zip" | |
| $mingwDirectory = Join-Path $env:RUNNER_TEMP "llvm-mingw-arm64" | |
| $mingwUrl = "https://github.com/mstorsjo/llvm-mingw/releases/download/$env:LLVM_MINGW_VERSION/llvm-mingw-$env:LLVM_MINGW_VERSION-ucrt-aarch64.zip" | |
| curl.exe --fail --location --retry 3 $mingwUrl --output $mingwArchive | |
| if ((Get-FileHash $mingwArchive -Algorithm SHA256).Hash.ToLowerInvariant() -ne $env:LLVM_MINGW_ARM64_SHA256) { | |
| throw "llvm-mingw ARM64 archive checksum mismatch" | |
| } | |
| Expand-Archive -Path $mingwArchive -DestinationPath $mingwDirectory -Force | |
| $mingwRoot = (Get-ChildItem $mingwDirectory -Directory | Select-Object -First 1).FullName | |
| $mingwLinker = Join-Path $mingwRoot "bin\aarch64-w64-mingw32-clang.exe" | |
| if (-not (Test-Path $mingwLinker)) { throw "Missing native ARM64 llvm-mingw driver" } | |
| @( | |
| "WAVE_LLVM_HOME=$llvmDirectory" | |
| "WAVE_WINDOWS_LLVM_BIN=$llvmDirectory\bin" | |
| "LLVM_SYS_211_PREFIX=$llvmDirectory" | |
| "LLVM_CONFIG_PATH=$llvmDirectory\bin\llvm-config.exe" | |
| "WAVE_WINDOWS_ARM64_LINKER=$mingwLinker" | |
| ) | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "$llvmDirectory\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| "$mingwRoot\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Provision pinned ARM64 libxml2 for LLVM | |
| shell: pwsh | |
| run: ./tools/provision_windows_arm64_libxml2.ps1 | |
| - name: Verify native ARM64 toolchains | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| if ($env:PROCESSOR_ARCHITECTURE -ne "ARM64") { throw "Expected an ARM64 runner" } | |
| if ((rustc -vV | Select-String '^host: ').Line -ne "host: aarch64-pc-windows-msvc") { | |
| throw "Rust is not using the native Windows ARM64 host toolchain" | |
| } | |
| & "$env:LLVM_CONFIG_PATH" --version | |
| & "$env:WAVE_WINDOWS_ARM64_LINKER" --version | |
| - name: Install Wave standard library | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $libraryRoot = Join-Path $HOME ".wave\lib\wave" | |
| New-Item -ItemType Directory -Force -Path $libraryRoot | Out-Null | |
| Copy-Item -Path std -Destination (Join-Path $libraryRoot "std") -Recurse | |
| # An explicit Cargo target keeps +crt-static off host build scripts. | |
| # llvm-sys 211 tests its own cfg!(crt-static) when classifying SDK | |
| # import libraries; applying target flags to that script requests | |
| # static bundling of psapi instead of leaving it for the MSVC linker. | |
| - name: Build native ARM64 compiler | |
| run: >- | |
| cargo build --locked --verbose --release --target aarch64-pc-windows-msvc | |
| --no-default-features | |
| --features llvm-target-aarch64 --jobs 2 | |
| - name: Verify native compiler architecture | |
| shell: pwsh | |
| run: | | |
| $compiler = "target\aarch64-pc-windows-msvc\release\wavec.exe" | |
| $bytes = [System.IO.File]::ReadAllBytes($compiler) | |
| $peOffset = [BitConverter]::ToInt32($bytes, 0x3c) | |
| if ([BitConverter]::ToUInt16($bytes, $peOffset + 4) -ne 0xaa64) { | |
| throw "wavec.exe is not an ARM64 PE image" | |
| } | |
| - name: Stage verified compiler for the case runner | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force target/release | Out-Null | |
| Copy-Item target/aarch64-pc-windows-msvc/release/wavec.exe target/release/wavec.exe -Force | |
| - name: Run all Wave cases | |
| run: >- | |
| python tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}.json | |
| - name: Upload case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}.json | |
| if-no-files-found: warn | |
| cases-cross-target: | |
| name: Cases ${{ matrix.id }} | |
| needs: case-config | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.cross) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install LLVM 21 and LLD | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y wget software-properties-common | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 21 | |
| sudo apt-get install -y lld-21 | |
| echo "LLVM_SYS_211_PREFIX=/usr/lib/llvm-21" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=/usr/lib/llvm-21/bin/llvm-config" >> "$GITHUB_ENV" | |
| echo "/usr/lib/llvm-21/bin" >> "$GITHUB_PATH" | |
| - name: Install Wave standard library | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Install LLVM 21 MinGW cross toolchain for Windows ARM64 | |
| if: ${{ matrix.id == 'windows-arm64' }} | |
| run: | | |
| set -euo pipefail | |
| archive="$RUNNER_TEMP/llvm-mingw.tar.xz" | |
| toolchain="$RUNNER_TEMP/llvm-mingw" | |
| url="https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-msvcrt-ubuntu-22.04-x86_64.tar.xz" | |
| curl --fail --location --retry 3 "$url" --output "$archive" | |
| echo "${LLVM_MINGW_SHA256} $archive" | sha256sum --check | |
| mkdir -p "$toolchain" | |
| tar -xJf "$archive" --strip-components=1 -C "$toolchain" | |
| test -x "$toolchain/bin/aarch64-w64-mingw32-gcc" | |
| echo "$toolchain/bin" >> "$GITHUB_PATH" | |
| echo "WAVE_WINDOWS_ARM64_LINKER=$toolchain/bin/aarch64-w64-mingw32-gcc" >> "$GITHUB_ENV" | |
| - name: Build release compiler | |
| run: cargo build --locked --release --jobs 2 | |
| - name: Run target suite | |
| run: >- | |
| python3 tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json "wave-cases-${{ matrix.id }}.json" | |
| - name: Link Windows ARM64 PE/COFF and C ABI fixture | |
| if: ${{ matrix.id == 'windows-arm64' }} | |
| env: | |
| WAVE_RUN_WINDOWS_ARM64_INTEROP_TESTS: "1" | |
| run: >- | |
| cargo test --locked --test codegen_regressions | |
| windows_arm64_c_abi_links_with_mingw -- --nocapture | |
| - name: Upload case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}.json | |
| if-no-files-found: warn | |
| cases-riscv64: | |
| name: Cases ${{ matrix.id }} (QEMU) | |
| needs: case-config | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.qemu) }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 40 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install LLVM 21, RISC-V sysroot, and QEMU | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y wget software-properties-common | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 21 | |
| sudo apt-get install -y \ | |
| gcc-riscv64-linux-gnu \ | |
| libc6-dev-riscv64-cross \ | |
| lld-21 \ | |
| qemu-user | |
| echo "LLVM_SYS_211_PREFIX=/usr/lib/llvm-21" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=/usr/lib/llvm-21/bin/llvm-config" >> "$GITHUB_ENV" | |
| echo "/usr/lib/llvm-21/bin" >> "$GITHUB_PATH" | |
| - name: Install Wave standard library | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Build release compiler | |
| run: cargo build --locked --release --jobs 2 | |
| - name: Compile Linux riscv64 cases | |
| run: >- | |
| python3 tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}-compile.json | |
| - name: Build and run portable cases under QEMU | |
| run: | | |
| set -euo pipefail | |
| target="${{ matrix.target }}" | |
| smoke_case="${{ matrix.smoke_case }}" | |
| smoke_stdout="${{ matrix.smoke_stdout }}" | |
| riscv_sysroot="$(target/release/wavec print sysroot --target "$target")" | |
| test -d "$riscv_sysroot" | |
| smoke_source="tests/cases/$smoke_case" | |
| smoke_name="$(basename "$smoke_source" .wave)" | |
| smoke_dir="$RUNNER_TEMP/wave-riscv64/smoke-$smoke_name" | |
| mkdir -p "$smoke_dir" | |
| target/release/wavec build "$smoke_source" \ | |
| --target "$target" \ | |
| --out-dir "$smoke_dir" | |
| elf_header="$(riscv64-linux-gnu-readelf -h "$smoke_dir/$smoke_name")" | |
| program_headers="$(riscv64-linux-gnu-readelf -l "$smoke_dir/$smoke_name")" | |
| grep -Eq 'Machine:[[:space:]]+RISC-V' <<< "$elf_header" | |
| grep -Eq 'Flags:[[:space:]]+0x5.*double-float ABI' <<< "$elf_header" | |
| grep -Fq '/lib/ld-linux-riscv64-lp64d.so.1' <<< "$program_headers" | |
| runtime_output="$(timeout --signal=TERM --kill-after=5s 30s \ | |
| qemu-riscv64 -L "$riscv_sysroot" "$smoke_dir/$smoke_name")" | |
| printf '%s\n' "$runtime_output" | |
| grep -Fqx -- "$smoke_stdout" <<< "$runtime_output" | |
| mapfile -t cases < <( | |
| python3 tools/case_manifest.py runtime-sources "${{ matrix.id }}" | |
| ) | |
| for source in "${cases[@]}"; do | |
| relative_source="$source" | |
| source="tests/cases/$source" | |
| case_name="$(basename "$source" .wave)" | |
| case_key="${relative_source//\//-}" | |
| output_dir="$RUNNER_TEMP/wave-riscv64/$case_key" | |
| mkdir -p "$output_dir" | |
| target/release/wavec build "$source" \ | |
| --target "$target" \ | |
| --out-dir "$output_dir" | |
| timeout --signal=TERM --kill-after=5s 30s \ | |
| qemu-riscv64 -L "$riscv_sysroot" "$output_dir/$case_name" | |
| done | |
| - name: Upload RISC-V case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}-compile.json | |
| if-no-files-found: warn | |
| cases-loongarch64: | |
| name: Cases ${{ matrix.id }} (QEMU) | |
| needs: case-config | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.loongarch) }} | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install LLVM 21, LLD, and QEMU | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y wget curl xz-utils software-properties-common qemu-user | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 21 | |
| sudo apt-get install -y lld-21 | |
| echo "LLVM_SYS_211_PREFIX=/usr/lib/llvm-21" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=/usr/lib/llvm-21/bin/llvm-config" >> "$GITHUB_ENV" | |
| echo "/usr/lib/llvm-21/bin" >> "$GITHUB_PATH" | |
| - name: Install pinned official LoongArch64 toolchain | |
| run: | | |
| set -euo pipefail | |
| archive="$RUNNER_TEMP/$LOONGARCH_TOOLCHAIN_ARCHIVE" | |
| url="https://github.com/loongson/build-tools/releases/download/$LOONGARCH_TOOLCHAIN_VERSION/$LOONGARCH_TOOLCHAIN_ARCHIVE" | |
| curl -L --fail --retry 3 "$url" -o "$archive" | |
| echo "$LOONGARCH_TOOLCHAIN_SHA256 $archive" | sha256sum -c - | |
| install_root="$RUNNER_TEMP/wave-loongarch64-toolchain" | |
| mkdir -p "$install_root" | |
| tar -xf "$archive" -C "$install_root" | |
| toolchain="$install_root/cross-tools" | |
| test -x "$toolchain/bin/loongarch64-unknown-linux-gnu-gcc" | |
| test -f "$toolchain/target/usr/lib64/ld-linux-loongarch-lp64d.so.1" | |
| echo "$toolchain/bin" >> "$GITHUB_PATH" | |
| echo "WAVE_LOONGARCH64_SYSROOT=$toolchain/target" >> "$GITHUB_ENV" | |
| - name: Install Wave standard library | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Build LoongArch-only compiler | |
| run: >- | |
| cargo build --locked --release --no-default-features | |
| --features llvm-target-loongarch --jobs 2 | |
| - name: Compile Linux LoongArch64 cases | |
| run: >- | |
| python3 tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}-compile.json | |
| - name: Verify hosted linking and run architecture cases | |
| run: | | |
| set -euo pipefail | |
| target="${{ matrix.target }}" | |
| detected_sysroot="$(target/release/wavec print sysroot --target "$target")" | |
| test "$detected_sysroot" = "$WAVE_LOONGARCH64_SYSROOT" | |
| smoke_source="tests/cases/${{ matrix.smoke_case }}" | |
| smoke_name="$(basename "$smoke_source" .wave)" | |
| smoke_dir="$RUNNER_TEMP/wave-loongarch64/smoke-$smoke_name" | |
| mkdir -p "$smoke_dir" | |
| target/release/wavec build "$smoke_source" \ | |
| --target "$target" \ | |
| --out-dir "$smoke_dir" | |
| elf_header="$(loongarch64-unknown-linux-gnu-readelf -h "$smoke_dir/$smoke_name")" | |
| program_headers="$(loongarch64-unknown-linux-gnu-readelf -l "$smoke_dir/$smoke_name")" | |
| grep -Eq 'Machine:[[:space:]]+LoongArch' <<< "$elf_header" | |
| grep -Eq 'Flags:[[:space:]]+0x43.*DOUBLE-FLOAT.*OBJ-v1' <<< "$elf_header" | |
| grep -Fq '/lib64/ld-linux-loongarch-lp64d.so.1' <<< "$program_headers" | |
| runtime_output="$(timeout --signal=TERM --kill-after=5s 30s \ | |
| qemu-loongarch64 -L "$detected_sysroot" "$smoke_dir/$smoke_name")" | |
| printf '%s\n' "$runtime_output" | |
| grep -Fqx -- "${{ matrix.smoke_stdout }}" <<< "$runtime_output" | |
| mapfile -t cases < <( | |
| python3 tools/case_manifest.py runtime-sources "${{ matrix.id }}" | |
| ) | |
| for source in "${cases[@]}"; do | |
| relative_source="$source" | |
| source="tests/cases/$source" | |
| case_name="$(basename "$source" .wave)" | |
| case_key="${relative_source//\//-}" | |
| output_dir="$RUNNER_TEMP/wave-loongarch64/$case_key" | |
| mkdir -p "$output_dir" | |
| target/release/wavec build "$source" \ | |
| --target "$target" \ | |
| --out-dir "$output_dir" | |
| timeout --signal=TERM --kill-after=5s 30s \ | |
| qemu-loongarch64 -L "$detected_sysroot" "$output_dir/$case_name" | |
| done | |
| - name: Run LoongArch64 LP64S and LP64D interop regressions | |
| env: | |
| WAVE_RUN_LOONGARCH64_INTEROP_TESTS: "1" | |
| run: >- | |
| cargo test --locked --no-default-features --features llvm-target-loongarch | |
| --test codegen_regressions loongarch64 -- --nocapture | |
| - name: Upload LoongArch64 case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}-compile.json | |
| if-no-files-found: warn | |
| cases-wasm: | |
| name: Cases ${{ matrix.id }} | |
| needs: case-config | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.case-config.outputs.wasm) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.89.0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install LLVM 21 and LLD | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y wget software-properties-common | |
| wget https://apt.llvm.org/llvm.sh | |
| chmod +x llvm.sh | |
| sudo ./llvm.sh 21 | |
| sudo apt-get install -y lld-21 | |
| echo "LLVM_SYS_211_PREFIX=/usr/lib/llvm-21" >> "$GITHUB_ENV" | |
| echo "LLVM_CONFIG_PATH=/usr/lib/llvm-21/bin/llvm-config" >> "$GITHUB_ENV" | |
| echo "/usr/lib/llvm-21/bin" >> "$GITHUB_PATH" | |
| - name: Install Wave standard library | |
| run: | | |
| mkdir -p "$HOME/.wave/lib/wave" | |
| rm -rf "$HOME/.wave/lib/wave/std" | |
| cp -R std "$HOME/.wave/lib/wave/std" | |
| - name: Build WebAssembly-only compiler | |
| run: >- | |
| cargo build --locked --release --no-default-features | |
| --features llvm-target-wasm --jobs 2 | |
| - name: Compile common and target-specific cases | |
| run: >- | |
| python3 tools/run_tests.py --target-id "${{ matrix.id }}" | |
| --report-json wave-cases-${{ matrix.id }}.json | |
| - name: Run WebAssembly-specific cases through the host | |
| run: | | |
| set -euo pipefail | |
| mapfile -t cases < <( | |
| python3 tools/case_manifest.py runtime-sources "${{ matrix.id }}" | |
| ) | |
| for source in "${cases[@]}"; do | |
| target/release/wavec run "tests/cases/$source" \ | |
| --target "${{ matrix.target }}" | |
| done | |
| - name: Upload WebAssembly case report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wave-cases-${{ matrix.id }} | |
| path: wave-cases-${{ matrix.id }}.json | |
| if-no-files-found: warn |