-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Split the tests per compiler and operating system on the upstre…
…am workflows
- Loading branch information
1 parent
65684f5
commit b7131db
Showing
10 changed files
with
459 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Clang Tests For Linux builds | ||
|
||
on: | ||
push: | ||
branches: 'main' | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
tests: | ||
name: Run the tests - Clang | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
clang_version: [15, 16, 17, 18] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Caching project dependencies | ||
id: project-cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- if: ${{ matrix.clang_version < 18 }} | ||
name: Install Clang ${{ matrix.clang_version }} | ||
run: | | ||
# Exit on error | ||
set -e | ||
# Download and execute the LLVM installation script for the specified Clang version | ||
echo "-----> Downloading and executing the LLVM installation script for Clang ${{ matrix.clang_version }}" | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x llvm.sh | ||
sudo ./llvm.sh ${{ matrix.clang_version }} | ||
echo "-----> Installing libc++" | ||
sudo apt-get install -y libc++-${{ matrix.clang_version }}-dev libc++abi-${{ matrix.clang_version }}-dev libunwind-${{ matrix.clang_version }} libunwind-${{ matrix.clang_version }}-dev libc6 libzstd1 | ||
# Update the symbolic link to point to the newly installed Clang version | ||
echo "-----> Updating the symbolic link to point to Clang ${{ matrix.clang_version }}" | ||
sudo rm -f /usr/bin/clang++ | ||
sudo ln -s /usr/bin/clang++-${{ matrix.clang_version }} /usr/bin/clang++ | ||
# Display the installation directory and version of the installed Clang | ||
echo "-----> Clang-${{ matrix.clang_version }} was installed on:" | ||
which clang-${{ matrix.clang_version }} | ||
echo "-----> Clang++ was installed on:" | ||
which clang++-${{ matrix.clang_version }} | ||
- if: ${{ matrix.clang_version < 18 }} | ||
name: Running the tests for the project | ||
run: | | ||
cd zork++ | ||
RUST_LOG=trace cargo test 2>&1 clang --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: GCC Tests For Linux builds | ||
|
||
on: | ||
push: | ||
branches: 'main' | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
tests: | ||
name: Run the tests - GCC | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Caching project dependencies | ||
id: project-cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Running the tests for the project | ||
run: | | ||
cd zork++ | ||
RUST_LOG=trace cargo test 2>&1 gcc --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: MSVC Tests For Windows builds | ||
|
||
on: | ||
push: | ||
branches: 'main' | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
tests: | ||
name: Run the tests - MSVC | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Caching project dependencies | ||
id: project-cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Setting up Rust | ||
uses: hecrj/setup-rust-action@v1 | ||
with: | ||
rust-version: stable | ||
|
||
- name: Running the tests for the project | ||
run: | | ||
cd zork++ | ||
cargo test 2>&1 msvc --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Code Coverage | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
code-coverage: | ||
permissions: | ||
contents: write | ||
env: | ||
CARGO_INCREMENTAL: '0' | ||
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | ||
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use nightly toolchain | ||
run: | | ||
rustup toolchain install nightly | ||
rustup override set nightly | ||
- name: Caching cargo dependencies | ||
id: project-cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} | ||
name: Install grcov | ||
run: cargo install grcov | ||
|
||
- name: Make the USER own the working directory | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: sudo chown -R $USER:$USER ${{ github.workspace }} | ||
|
||
- name: Run tests | ||
working-directory: zork++ | ||
run: | | ||
cargo test --all-features --no-fail-fast --target=x86_64-unknown-linux-gnu -- --show-output --test-threads=1 | ||
- name: Generate code coverage report | ||
working-directory: zork++ | ||
run: | | ||
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage | ||
grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore-not-existing -o ./target/debug/coverage/code_cov.xml | ||
- name: Publish Test Results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Unit Test Results | ||
path: | | ||
./zork++/target/debug/coverage/code_cov.xml | ||
./zork++/target/debug/coverage/index.html | ||
- name: Publish coverage report to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: ./zork++/target/debug/coverage | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Code quality and sanity | ||
|
||
on: | ||
push: | ||
branches: 'main' | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
clippy: | ||
name: Lint with Clippy | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: -Dwarnings | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Caching project dependencies | ||
id: project-cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- uses: hecrj/setup-rust-action@v1 | ||
with: | ||
components: clippy | ||
|
||
- name: Verifiying the code quality with Clippy | ||
run: | | ||
cd zork++ | ||
cargo clippy --all-targets --all-features | ||
rustfmt: | ||
name: Verify code formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Caching project dependencies | ||
id: project-cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- uses: hecrj/setup-rust-action@v2 | ||
with: | ||
components: rustfmt | ||
|
||
- name: Checking the format sanity of the project | ||
run: | | ||
cd zork++ | ||
cargo fmt --all -- --check | ||
- name: Run Unit and Doc tests | ||
run: | | ||
cargo test --workspace --lib --color=always --no-fail-fast | ||
cargo test --workspace --doc --color=always --no-fail-fast |
Oops, something went wrong.