Skip to content

[SOL] Fix ci

[SOL] Fix ci #192

Workflow file for this run

name: CI
on: [push, pull_request]
env:
RUSTDOCFLAGS: -Dwarnings
RUSTFLAGS: -Dwarnings
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
#- target: aarch64-apple-darwin
# os: macos-14
# rust: nightly
#- target: aarch64-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: arm-unknown-linux-gnueabi
# os: ubuntu-latest
# rust: nightly
#- target: arm-unknown-linux-gnueabihf
# os: ubuntu-latest
# rust: nightly
#- target: i586-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: i686-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
# MIPS targets disabled since they are dropped to tier 3.
# See https://github.com/rust-lang/compiler-team/issues/648
#- target: mips-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: mips64-unknown-linux-gnuabi64
# os: ubuntu-latest
# rust: nightly
#- target: mips64el-unknown-linux-gnuabi64
# os: ubuntu-latest
# rust: nightly
#- target: mipsel-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: powerpc-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: powerpc64-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: powerpc64le-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
- target: sbf-solana-solana
os: ubuntu-latest
rust: nightly
#- target: thumbv6m-none-eabi
# os: ubuntu-latest
# rust: nightly
#- target: thumbv7em-none-eabi
# os: ubuntu-latest
# rust: nightly
#- target: thumbv7em-none-eabihf
# os: ubuntu-latest
# rust: nightly
#- target: thumbv7m-none-eabi
# os: ubuntu-latest
# rust: nightly
#- target: wasm32-unknown-unknown
# os: ubuntu-latest
# rust: nightly
#- target: x86_64-unknown-linux-gnu
# os: ubuntu-latest
# rust: nightly
#- target: x86_64-apple-darwin
# os: macos-latest
# rust: nightly
#- target: i686-pc-windows-msvc
# os: windows-latest
# rust: nightly
#- target: x86_64-pc-windows-msvc
# os: windows-latest
# rust: nightly
#- target: i686-pc-windows-gnu
# os: windows-latest
# rust: nightly-i686-gnu
#- target: x86_64-pc-windows-gnu
# os: windows-latest
# rust: nightly-x86_64-gnu
steps:
- name: Print runner information
run: uname -a
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust (rustup)
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
shell: bash
- run: rustup target add ${{ matrix.target }}
if: matrix.target != 'sbf-solana-solana'
- run: rustup component add llvm-tools-preview
- name: Download compiler-rt reference sources
run: |
curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/18.0-2024-02-13.tar.gz
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-18.0-2024-02-13/compiler-rt
echo RUST_COMPILER_RT_ROOT=./compiler-rt >> $GITHUB_ENV
shell: bash
# Non-linux tests just use our raw script
- run: ./ci/run.sh ${{ matrix.target }}
if: matrix.os != 'ubuntu-latest'
shell: bash
# Otherwise we use our docker containers to run builds
- run: cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
if: matrix.os == 'ubuntu-latest'
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable `rustfmt`
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
# Unlike rustfmt, stable clippy does not work on code with nightly features.
# This acquires the most recent nightly with a clippy component.
- name: Install nightly `clippy`
run: |
rustup set profile minimal && rustup default "nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)" && rustup component add clippy
- run: cargo clippy -- -D clippy::all
success:
needs:
- test
- rustfmt
- clippy
runs-on: ubuntu-latest
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'