chore: Clearer assertions #305
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
name: Rust | |
on: | |
push: | |
branches: | |
- '*' | |
- '!gh-pages' | |
pull_request: | |
env: | |
# rust 1.68 | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
RUST_BACKTRACE: 1 | |
MIRIFLAGS: -Zmiri-disable-isolation | |
# taken from <rustc/src/ci/scripts/install-mingw.sh>. | |
MIRRORS_BASE: https://ci-mirrors.rust-lang.org/rustc | |
strategy: | |
matrix: | |
target: | |
- x86_64-pc-windows-msvc | |
- i686-pc-windows-msvc | |
- x86_64-pc-windows-gnu | |
- i686-pc-windows-gnu | |
include: | |
- target: x86_64-pc-windows-gnu | |
archive: x86_64-12.2.0-release-posix-seh-rt_v10-rev0.7z | |
mingw_dir: mingw64 | |
- target: i686-pc-windows-gnu | |
archive: i686-12.2.0-release-posix-dwarf-rt_v10-rev0.7z | |
mingw_dir: mingw32 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup set auto-self-update disable | |
rustup toolchain install stable-${{ matrix.target }} | |
rustup default stable-${{ matrix.target }} | |
- name: Check out MinGW toolchain | |
# NOTE: The self-contained rust-mingw is enough for linking to Windows. | |
# Full MinGW toolchain is only needed when compiling C code. | |
#if: matrix.mingw_dir | |
if: false | |
run: | | |
set -x | |
curl -sSf -O "$MIRRORS_BASE/${{ matrix.archive }}" | |
7z x -y "${{ matrix.archive }}" -o/c/mingw | |
rm "${{ matrix.archive }}" | |
ls -l "/c/mingw/${{ matrix.mingw_dir }}/bin" | |
echo "C:\mingw\${{ matrix.mingw_dir }}\bin" >> $GITHUB_PATH | |
shell: bash | |
- run: cargo fetch | |
- run: cargo build | |
- run: cargo build --features nightly | |
- run: cargo build --all-targets | |
- run: cargo test | |
- run: cargo test --no-default-features | |
# NOTE: miri still needs to support more Windows API shims | |
- if: false | |
run: | | |
rustup component add miri | |
cargo clean | |
cargo miri setup | |
cargo miri test | |
- if: failure() | |
run: | | |
Set-PSDebug -Trace 1 | |
Get-ChildItem -Path target\debug\junction-test-*\ | Select-Object FullName, Target | |
Get-ChildItem -Path target\debug\junction-test-*\junction | Select-Object FullName, Target | |
shell: powershell | |
- if: failure() | |
run: | | |
dir /aL C:\ | |
dir /aL C:\Users | |
shell: cmd | |
msrv: | |
runs-on: windows-latest | |
# needs: [build] | |
env: | |
# assert! in consts | |
MSRV: 1.57.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup set auto-self-update disable | |
rustup toolchain install ${{ env.MSRV }} | |
rustup default ${{ env.MSRV }} | |
- run: | | |
rustup run stable cargo fetch | |
- run: | | |
cargo build --locked | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: cargo fmt -- --check | |
rustdoc: | |
runs-on: windows-latest | |
steps: | |
- name: Before checking out source and change \n -> \r\n | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup set auto-self-update disable | |
rustup toolchain install nightly | |
rustup default nightly | |
- run: cargo doc --all --no-deps # --document-private-items | |
- run: echo '<meta http-equiv=refresh content=0;url=junction/index.html>' > target/doc/index.html | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: target/doc | |
retention-days: 1 | |
deploy: | |
if: github.event_name != 'pull_request' && github.event.ref == 'refs/heads/main' | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
needs: [rustdoc] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
clippy: | |
runs-on: windows-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup set auto-self-update disable | |
rustup toolchain install nightly -c clippy | |
rustup default nightly | |
- run: cargo fetch | |
- run: cargo clippy --all-targets --all-features -- -Dwarnings | |
# Use static analyzer Rudra <https://github.com/sslab-gatech/Rudra>. | |
# FIXME: Disable for now since it's very costly to run. | |
rudra: | |
if: false | |
runs-on: ubuntu-latest | |
env: | |
MSRV: nightly-2021-08-20 | |
WIN_TARGET: x86_64-pc-windows-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: junction | |
- uses: actions/checkout@v4 | |
with: | |
repository: sslab-gatech/Rudra | |
path: Rudra | |
- name: setup | |
shell: bash | |
run: | | |
# Toolchain setup | |
rustup set auto-self-update disable | |
rustup toolchain install ${{ env.MSRV }} -c rustc-dev -c miri | |
rustup default ${{ env.MSRV }} | |
rustup target add ${{ env.WIN_TARGET }} | |
# Environment variable setup, put these in your `.bashrc` | |
export RUDRA_RUST_CHANNEL=${{ env.MSRV }} | |
export RUDRA_RUNNER_HOME="$HOME/rudra-home" | |
./setup_rudra_runner_home.py ${RUDRA_RUNNER_HOME} | |
RUDRA_LIB=$HOME/.rustup/toolchains/${RUDRA_RUST_CHANNEL}-x86_64-unknown-linux-gnu/lib | |
export RUSTFLAGS="-L ${RUDRA_LIB}" | |
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${RUDRA_LIB}" | |
echo "RUDRA_RUNNER_HOME=${RUDRA_RUNNER_HOME}" >> $GITHUB_ENV | |
echo "RUDRA_RUST_CHANNEL=${RUDRA_RUST_CHANNEL}" >> $GITHUB_ENV | |
echo "RUSTFLAGS=${RUSTFLAGS}" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV | |
working-directory: Rudra | |
- name: run | |
run: | | |
./install-release.sh | |
shell: bash | |
working-directory: Rudra | |
- run: | | |
# for single file testing (you need to set library include path, or use `cargo run` instead) | |
# rudra --crate-type lib tests/unsafe_destructor/normal1.rs | |
cargo rudra --target ${{ env.WIN_TARGET }} --all-targets # for crate compilation | |
working-directory: junction |