Skip to content

play with ci

play with ci #407

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
env:
CARGO_TERM_COLOR: always
CARGO_HOME: ${{ github.workspace }}/.cargo
RUSTFLAGS: -D warnings -A unused-imports
RUSTDOCFLAGS: -D warnings
RUST_BACKTRACE: full
jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update stable --no-self-update
- run: rustc -Vv
- run: cargo fmt --all -- --check
unit-tests:
name: ${{ matrix.basename }} - ${{ matrix.os }} - ${{ matrix.toolchain }} - ${{ matrix.llvm[0] }} - ${{ matrix.features }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
llvm:
- ["15.0", "15-0"]
- ["16.0", "16-0"]
- ["17.0", "17-0"]
- ["18.1", "18-1"]
toolchain:
- stable
os:
- ubuntu-latest
- macos-latest
features:
- "rayon cranelift"
experimental:
- false
tests:
- true
clippy:
- false
rustdoc:
- false
basename:
- Tests
include:
- toolchain: stable
os: ubuntu-latest
llvm: ["18.1", "18-1"]
features: "cranelift"
experimental: true
- toolchain: stable
os: windows-latest
llvm: ""
features: "rayon cranelift"
- toolchain: beta
os: ubuntu-latest
llvm: ["16.0", "16-0"]
experimental: true
- toolchain: nightly
os: ubuntu-latest
llvm: ["16.0", "16-0"]
- toolchain: stable
os: ubuntu-latest
llvm: ""
features: ""
- toolchain: stable
os: ubuntu-latest
llvm: ""
features: "rayon"
- toolchain: stable
os: ubuntu-latest
llvm: ""
features: "cranelift"
- toolchain: stable
os: ubuntu-latest
llvm: ["16.0", "16-0"]
features: "rayon cranelift"
tests: false
clippy: true
basename: Clippy
experimental: true
- toolchain: nightly
os: ubuntu-latest
llvm: ["16.0", "16-0"]
features: "rayon cranelift"
tests: false
experimental: true
rustdoc: true
basename: Rustdoc
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/cache@v3
with:
path: |
${{ env.CARGO_HOME }}
target
key: unit-test-${{ runner.os }}-${{ matrix.toolchain}}-${{ matrix.llvm[0] }}-${{ matrix.features }}
- name: Set up Rust
run: rustup default ${{ matrix.toolchain }} && rustup update ${{ matrix.toolchain }} --no-self-update && rustup component add clippy rust-docs
- name: Rust version
run: rustc -Vv
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
if : matrix.llvm != '' && (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' || matrix.os == 'ubuntu-24.04-arm')
with:
version: ${{ matrix.llvm[0] }}
- name: Install LLVM 16 (macos-13)
if : matrix.os == 'macos-13'
run:
brew install llvm@16
- name: Install dependencies (for ubuntu-latest and LLVM 18.1)
if : matrix.llvm[0] == '18.1' && matrix.os == 'ubuntu-latest'
run: |
sudo apt update
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb
sudo apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Run tests (LLVM)
if : matrix.tests && matrix.llvm != ''
run: cargo test --verbose --features llvm${{ matrix.llvm[1] }} --features "${{ matrix.features }}"
- name: Run tests
if : matrix.tests && matrix.llvm == ''
run: cargo test --verbose --features "${{ matrix.features }}"
- name: Run Clippy (LLVM)
if: matrix.clippy
run: cargo clippy --verbose --features llvm${{ matrix.llvm[1] }} --features "${{ matrix.features }}"
- name: Run Docs (LLVM)
if: matrix.rustdoc
run: cargo rustdoc --features llvm${{ matrix.llvm[1] }} --features "${{ matrix.features }}"
book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook build book
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/book