Skip to content

Build native Windows #10

Build native Windows

Build native Windows #10

name: Build native Windows
on:
workflow_call:
inputs:
profiles:
type: string
required: true
workflow_dispatch:
inputs:
profiles:
type: string
default: '[{ "name": "debug", "flags": "" }]'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
TERM: xterm-256color
BINARYEN_VERSION: version_111
jobs:
win-native:
runs-on: ci-win
strategy:
matrix:
profiles: ${{ fromJson(inputs.profiles) }}
fail-fast: false
name: win-native (${{ matrix.profiles.name }})
defaults:
run:
shell: msys2 {0}
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Setup MSYS2 environment"
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: >-
procps
mingw-w64-x86_64-protobuf
- name: "Install: Rustup"
run: |
Invoke-WebRequest -OutFile rustup-init.exe https://win.rustup.rs/x86_64
.\rustup-init.exe -y
Remove-Item rustup-init.exe
shell: powershell
- name: "Install: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1
- name: "ACTIONS: Setup caching"
uses: Swatinem/rust-cache@v2
with:
key: "${{ matrix.profiles.name }}"
save-if: ${{ github.ref == 'refs/heads/master' }}
- name: "Install: cargo-nextest"
run: |
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'zip' } -PassThru
Invoke-WebRequest -OutFile $tmp https://get.nexte.st/latest/windows
$outputDir = if ($Env:CARGO_HOME) { Join-Path $Env:CARGO_HOME "bin" } else { "~/.cargo/bin" }
$tmp | Expand-Archive -DestinationPath $outputDir -Force
$tmp | Remove-Item
shell: powershell
- name: "Install: cargo-hack"
run: |
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'tar.gz' } -PassThru
Invoke-WebRequest -OutFile $tmp https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-pc-windows-msvc.tar.gz
$outputDir = if ($Env:CARGO_HOME) { Join-Path $Env:CARGO_HOME "bin" } else { Resolve-Path "~/.cargo/bin" }
tar zxf $tmp -C $outputDir
$tmp | Remove-Item
shell: powershell
- name: "Install: binaryen"
run: |
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'tar.gz' } -PassThru
Invoke-WebRequest -OutFile $tmp "https://github.com/WebAssembly/binaryen/releases/download/$Env:BINARYEN_VERSION/binaryen-$Env:BINARYEN_VERSION-x86_64-windows.tar.gz"
$outputDir = if ($Env:CARGO_HOME) { Join-Path $Env:CARGO_HOME "bin" } else { "~/.cargo/bin" }
tar zxf $tmp
cp "./binaryen-$Env:BINARYEN_VERSION/bin/*" $outputDir
Remove-Item -Recurse "./binaryen-$Env:BINARYEN_VERSION"
$tmp | Remove-Item
shell: powershell
- name: "Install: wabt"
run: |
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'tar.gz' } -PassThru
Invoke-WebRequest -OutFile $tmp https://github.com/WebAssembly/wabt/releases/download/1.0.29/wabt-1.0.29-windows.tar.gz
$outputDir = if ($Env:CARGO_HOME) { Join-Path $Env:CARGO_HOME "bin" } else { "~/.cargo/bin" }
tar zxf $tmp
cp ./wabt-1.0.29/bin/* $outputDir
Remove-Item -Recurse ./wabt-1.0.29
$tmp | Remove-Item
shell: powershell
- name: "Build: Node"
run: ./scripts/gear.sh build node --release --locked
- name: "Check: Stack height limit"
# no need to run check twice
if: ${{ matrix.profiles.name == 'release' }}
run: cargo run -p calc-stack-height --release --locked
- name: "Test: gsdk tests"
run: ./scripts/gear.sh test gsdk ${{ matrix.profiles.flags }}
- name: "Test: Client tests"
run: ./scripts/gear.sh test client ${{ matrix.profiles.flags }}
- name: "Test: Lazy pages"
run: >-
cargo nextest run
-p "pallet-*"
-p gear-lazy-pages
-p gear-runtime-interface
${{ matrix.profiles.flags }}