Skip to content

Commit

Permalink
Improve CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fmease committed Jul 18, 2022
1 parent 9f02a20 commit 017c5b2
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 54 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rustflags = [
# Used by the GitHub CI workflow.
# This profile is necessary since the workflow cannot simply set the environment variables
# RUSTFLAGS and RUSTDOCFLAGS itself without overwriting the meticulously chosen flags set above!
# With profiles, those flags are inherited from / appended to the parent.
[profile.ci]
inherits = "release"
rustflags = ["-Dwarnings"]
Expand Down
100 changes: 54 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ on:
# 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 Linux (Ubuntu)
name: Build on (Ubuntu) Linux

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- 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
Expand All @@ -37,29 +41,30 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- 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 Linux (Ubuntu)
name: Run tests on (Ubuntu) Linux

needs: build-on-linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Run unit tests (via the rust testing framework)
run: cargo test
- name: Run UI tests (via the golden UI testing framework)
# @Task build with LLVM and Cranelift
- 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 llvm_codegen --features cranelift,lsp
- name: Run UI tests
# @Task test with LLVM and Cranelift
run: ./test/ui/run --release --timeout=20

test-on-windows:
Expand All @@ -72,29 +77,30 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Run unit tests (via the rust testing framework)
run: cargo test
- name: Run UI tests (via the golden UI testing framework)
- 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 llvm_codegen --features cranelift,lsp
- name: Run UI tests
# @Task build with LLVM and Cranelift
run: ./tests/ui/run --release --timeout=20

build-documentation:
name: Build Documentation (on Linux)
name: Build documentation (on Linux)

needs: build-on-linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Build documentation with rustdoc excluding dependencies
# @Task build with LLVM
- name: Check out the repository
uses: actions/checkout@v3
- name: Install Rust
run: rustup update --no-self-update nightly
- name: Build documentation with rustdoc
# @Task document with LLVM
run: cargo doc --profile ci --no-deps --features cranelift,lsp

clippy:
Expand All @@ -104,25 +110,27 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: clippy
- 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 build with LLVM
# @Task check with LLVM
run: cargo clippy --profile ci --features cranelift,lsp

formatting:
name: Check Code Formatting
name: Check code formatting

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- name: Run rustfmt in check mode
run: cargo fmt --check
- 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
2 changes: 1 addition & 1 deletion compiler/driver/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(generic_arg_infer, let_chains)]
#![feature(generic_arg_infer)]

use std::process::Command;

Expand Down
1 change: 0 additions & 1 deletion compiler/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
default_free_fn,
let_else,
associated_type_bounds,
let_chains,
type_alias_impl_trait
)]

Expand Down
2 changes: 1 addition & 1 deletion compiler/llvm_codegen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! The LLVM-IR generator.
#![feature(default_free_fn, let_chains)]
#![feature(default_free_fn)]
#![allow(clippy::match_same_arms)] // @Temporary

use diagnostics::Diagnostic;
Expand Down
2 changes: 1 addition & 1 deletion compiler/package/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! The package and component resolver.
#![feature(default_free_fn, let_chains, let_else, try_trait_v2)]
#![feature(default_free_fn, let_else, try_trait_v2)]

use diagnostics::{reporter::ErasedReportedError, Diagnostic, ErrorCode, Reporter};
use error::Result;
Expand Down
2 changes: 1 addition & 1 deletion compiler/resolver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! respectively.
// @Task improve docs above!
// @Task get rid of "register" terminology
#![feature(default_free_fn, let_chains, let_else)]
#![feature(default_free_fn, let_else)]

use colored::Colorize;
use diagnostics::{reporter::ErasedReportedError, Diagnostic, ErrorCode, LintCode};
Expand Down
2 changes: 1 addition & 1 deletion compiler/server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! An LSP language server for the Lushui programming language.
#![feature(default_free_fn, let_chains, let_else)]
#![feature(default_free_fn, let_else)]

use self::diagnostics::DiagnosticExt;
use self::span::{FromPositionExt, ToLocationExt};
Expand Down
4 changes: 2 additions & 2 deletions lushui
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# Build and run the Lushui compiler.
#
# By default, optional compiler feature are not built.
# All program arguments are passed to the compiler
# By default, optional compiler features are not built.
# All program arguments of this script are passed to the compiler
# except for the first one if it starts with a ‘+’.
# In such case, the argument denotes a comma-separated
# list of compiler features.
Expand Down

0 comments on commit 017c5b2

Please sign in to comment.