Skip to content

Format the code base #374

Format the code base

Format the code base #374

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
schedule:
[cron: "0 0 1 * *"]
# Ideally, do not set ‘RUSTFLAGS’ or ‘RUSTDOCFLAGS’ anywhere in here! It would overwrite the flags
# set in ‘.cargo/config.toml’! Instead, make use of the Cargo profile ‘ci’ defined in the
# aforementioned config file whose registered Rust flags are *appended* to the parent profile's ones.
env:
CARGO_TERM_COLOR: always
RUSTUP_TOOLCHAIN: nightly
# @Task add back dependency caching once we've figured out how to do it properly
# (before: always cache misses)
jobs:
build-on-linux:
name: Build on (Ubuntu) Linux
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: rustup update --no-self-update nightly
- name: Build in release mode
# @Task build with LLVM
run: cargo build --profile ci --features cranelift,lsp
build-on-windows:
name: Build on Windows
# disabled to reduce resource usage and since it's not as important right now
if: false
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: rustup update --no-self-update nightly
- name: Build in release mode
# @Task build with LLVM
run: cargo build --profile ci --features cranelift,lsp
test-on-linux:
name: Run tests on (Ubuntu) Linux
needs: build-on-linux
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: rustup update --no-self-update nightly
- name: Run unit tests
# @Task test with LLVM
run: cargo test --workspace --exclude codegen_llvm --features cranelift,lsp
- name: Run UI tests
# @Task test with LLVM and Cranelift
run: ./test/run ui --release --timeout=20
test-on-windows:
name: Run tests on Windows
# disabled to reduce resource usage and since it's not as important right now
if: false
needs: build-on-windows
runs-on: windows-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: rustup update --no-self-update nightly
- name: Run unit tests
# @Task test with LLVM
run: cargo test --workspace --exclude codegen_llvm --features cranelift,lsp
- name: Run UI tests
# @Task build with LLVM and Cranelift
run: ./test/run ui --release --timeout=20
build-documentation:
name: Build documentation (on Linux)
needs: build-on-linux
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: rustup update --no-self-update nightly
- name: Check the rustdoc documentation
# @Task document with LLVM
run: cargo doc --profile ci --workspace --exclude codegen_llvm --no-deps --features cranelift,lsp
env:
# Unfortunately, we *do* need to resort to an ostracized env var here
# since ‘rustdocflags’ (or an equivalent) is not supported in
# Cargo profiles (yet, maybe): cargo#10271.
# This is currently semi-acceptable since none of the (lint-related)
# Rust flags set in the config file (for all profiles) are
# rustdoc-specific and lint violations should thus have already
# been caught by the ‘build-on-linux’ CI job.
RUSTDOCFLAGS: -Dwarnings --check -Zunstable-options
clippy:
name: Run Clippy (on Linux)
needs: build-on-linux
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: |
rustup update --no-self-update nightly
rustup component add clippy
- name: Run Clippy
# @Task check with LLVM
run: cargo clippy --profile ci --features cranelift,lsp --workspace --exclude codegen_llvm
formatting:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: |
rustup update --no-self-update nightly
rustup component add rustfmt
- name: Check code formatting
run: cargo fmt --all --check