CI #10537
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: CI | |
on: | |
schedule: | |
- cron: "0 3 * * *" | |
push: | |
branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: short | |
TERM: xterm-256color | |
BINARYEN_VERSION: version_111 | |
jobs: | |
# TODO: add to specific branches. | |
# spec_version: | |
# runs-on: [kuberunner] | |
# steps: | |
# - name: "ACTIONS: Checkout" | |
# uses: actions/checkout@v4 | |
# - name: "Fetch origin" | |
# run: git fetch origin | |
# - name: "Check spec version" | |
# if: ${{ ! contains(github.event.pull_request.labels.*.name, 'A4-insubstantial') }} | |
# run: ./scripts/check-spec.sh | |
cache: | |
runs-on: ubuntu-latest | |
outputs: | |
sccache_path: ${{ steps.sccache.outputs.sccache_path }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: "CACHE: Set sccache path" | |
id: sccache | |
run: | | |
sccache_path="/mnt/sccache/$(echo ${GITHUB_REF#refs/heads/} | tr / _)" | |
echo "sccache_path=$sccache_path" >> $GITHUB_OUTPUT | |
check: | |
needs: [cache] | |
uses: ./.github/workflows/check.yml | |
with: | |
cache: ${{ needs.cache.outputs.sccache_path }} | |
build: | |
needs: [cache] | |
uses: ./.github/workflows/build.yml | |
with: | |
cache: ${{ needs.cache.outputs.sccache_path }} | |
macos: true | |
build-win-native: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: build | |
runs-on: ci-win | |
defaults: | |
run: | |
shell: msys2 {0} | |
env: | |
CARGO_INCREMENTAL: 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: Rust toolchain" | |
uses: dsherret/rust-toolchain-file@v1 | |
- 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: "Test: gsdk tests" | |
run: ./scripts/gear.sh test gsdk --release | |
- name: "Test: Client tests" | |
run: ./scripts/gear.sh test client --release | |
- name: "Test: Lazy pages" | |
run: >- | |
cargo nextest run | |
-p "pallet-*" | |
-p gear-lazy-pages | |
-p gear-runtime-interface | |
--release | |
upload: | |
if: github.event_name == 'push' && github.ref_name == 'master' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Delete previous release | |
uses: dev-drprasad/[email protected] | |
with: | |
delete_release: true | |
tag_name: build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sleep | |
run: sleep 10 | |
- name: Upload | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: true | |
tag_name: build | |
draft: false | |
fail_on_unmatched_files: true | |
files: artifact/* |