Skip to content

Replace subspace-runtime with subspace-fake-runtime-api #318

Replace subspace-runtime with subspace-fake-runtime-api

Replace subspace-runtime with subspace-fake-runtime-api #318

Workflow file for this run

name: Rust
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:
merge_group:
concurrency:
group: rust-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Not needed in CI, should make things a bit faster
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
# TODO: AES flag is such that we have decent performance on ARMv8, remove once `aes` crate bumps MSRV to at least
# 1.61: https://github.com/RustCrypto/block-ciphers/issues/373
RUSTFLAGS: --cfg aes_armv8
# Remove unnecessary WASM build artefacts
WASM_BUILD_CLEAN_TARGET: 1
jobs:
cargo-fmt:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
- name: Install Protoc
uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9 # v2.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: cargo fmt
run: cargo fmt --all -- --check
cargo-clippy:
strategy:
matrix:
os:
- ubuntu-22.04
- macos-14
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install GTK4 (Ubuntu)
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libgtk-4-dev
if: runner.os == 'Linux'
- name: Install GTK4 (macOS)
run: brew install gtk4
if: runner.os == 'macOS'
- name: Configure GTK4 cache (Windows)
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache
with:
path: C:\gtk-build\gtk\x64\release
key: ${{ runner.os }}-gtk4
if: runner.os == 'Windows'
- name: Install GTK4 (Windows)
run: |
pipx install gvsbuild
gvsbuild build gtk4 librsvg
if: runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true'
- name: Configure GTK4 (Windows)
run: |
Add-Content $env:GITHUB_ENV "PKG_CONFIG_PATH=C:\gtk-build\gtk\x64\release\lib\pkgconfig"
Add-Content $env:GITHUB_ENV ("LIB=" + $env:LIB + ";" + "C:\gtk-build\gtk\x64\release\lib")
Add-Content $env:GITHUB_PATH "C:\gtk-build\gtk\x64\release\bin"
# We have hardcoded list of libraries in space-acres.wxs, make sure it didn't change unexpectedly
Get-ChildItem C:\gtk-build\gtk\x64\release\bin\*.dll | ForEach-Object { $_.Name } > actual-dlls.log
if (Compare-Object -ReferenceObject (Get-Content -Path res\windows\wix\expected-dlls.log) -DifferenceObject (Get-Content -Path actual-dlls.log)) {
Write-Output "Expected DLLs:"
Get-Content res\windows\wix\expected-dlls.log
Write-Output "Actual DLLs:"
Get-Content actual-dlls.log
Throw "Actual DLLs do not match expected"
}
if: runner.os == 'Windows'
# On macOS, we need a proper Clang version, not Apple's custom version without wasm32 support
- name: Install LLVM and Clang for macOS
uses: KyleMayes/install-llvm-action@dec985c8d7b46a2f363ea1a78f660c946a3349ea # v2.0.1
with:
env: true
version: 17
if: runner.os == 'macOS'
# Because macOS, see https://andreasfertig.blog/2021/02/clang-and-gcc-on-macos-catalina-finding-the-include-paths/
- name: Configure C compiler macOS
run: |
echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
if: runner.os == 'macOS'
- name: Install glibtoolize (macOS)
run: brew install libtool
if: runner.os == 'macOS'
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Needed for hwloc
- name: Install automake (macOS)
run: brew install automake
if: runner.os == 'macOS'
# Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
- name: Remove msys64
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
if: runner.os == 'Windows'
# Doesn't exist on self-hosted runners
continue-on-error: true
- name: Configure cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: cargo clippy
run: cargo -Zgitoxide -Zgit clippy --locked --all-targets -- -D warnings
cargo-test:
strategy:
matrix:
os:
- ubuntu-22.04
- macos-14
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install GTK4 (Ubuntu)
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libgtk-4-dev
if: runner.os == 'Linux'
- name: Install GTK4 (macOS)
run: brew install gtk4
if: runner.os == 'macOS'
- name: Configure GTK4 cache (Windows)
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache
with:
path: C:\gtk-build\gtk\x64\release
key: ${{ runner.os }}-gtk4
if: runner.os == 'Windows'
- name: Install GTK4 (Windows)
run: |
pipx install gvsbuild
gvsbuild build gtk4 librsvg
if: runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true'
- name: Configure GTK4 (Windows)
run: |
Add-Content $env:GITHUB_ENV "PKG_CONFIG_PATH=C:\gtk-build\gtk\x64\release\lib\pkgconfig"
Add-Content $env:GITHUB_ENV ("LIB=" + $env:LIB + ";" + "C:\gtk-build\gtk\x64\release\lib")
Add-Content $env:GITHUB_PATH "C:\gtk-build\gtk\x64\release\bin"
# We have hardcoded list of libraries in space-acres.wxs, make sure it didn't change unexpectedly
Get-ChildItem C:\gtk-build\gtk\x64\release\bin\*.dll | ForEach-Object { $_.Name } > actual-dlls.log
if (Compare-Object -ReferenceObject (Get-Content -Path res\windows\wix\expected-dlls.log) -DifferenceObject (Get-Content -Path actual-dlls.log)) {
Write-Output "Expected DLLs:"
Get-Content res\windows\wix\expected-dlls.log
Write-Output "Actual DLLs:"
Get-Content actual-dlls.log
Throw "Actual DLLs do not match expected"
}
if: runner.os == 'Windows'
# On macOS, we need a proper Clang version, not Apple's custom version without wasm32 support
- name: Install LLVM and Clang for macOS
uses: KyleMayes/install-llvm-action@dec985c8d7b46a2f363ea1a78f660c946a3349ea # v2.0.1
with:
env: true
version: 17
if: runner.os == 'macOS'
# Because macOS, see https://andreasfertig.blog/2021/02/clang-and-gcc-on-macos-catalina-finding-the-include-paths/
- name: Configure C compiler macOS
run: |
echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
if: runner.os == 'macOS'
- name: Install glibtoolize (macOS)
run: brew install libtool
if: runner.os == 'macOS'
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Needed for hwloc
- name: Install automake (macOS)
run: brew install automake
if: runner.os == 'macOS'
# Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
- name: Remove msys64
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
if: runner.os == 'Windows'
# Doesn't exist on self-hosted runners
continue-on-error: true
- name: Configure cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install cargo-nextest
uses: taiki-e/cache-cargo-install-action@5b024fe3a0a2c7f2aaff0e47871acf0d14b07207 # v2.0.0
with:
tool: cargo-nextest
- name: cargo nextest run --locked
run: cargo -Zgitoxide -Zgit nextest run --locked