ci: fetch before build #282
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: | |
# rust 1.68 | |
env: | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
RUST_BACKTRACE: 1 | |
MINGW_URL: https://ci-mirrors.rust-lang.org/rustc | |
MIRIFLAGS: -Zmiri-disable-isolation | |
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-6.3.0-release-posix-seh-rt_v5-rev2.7z | |
mingw_dir: mingw64 | |
- target: i686-pc-windows-gnu | |
archive: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z | |
mingw_dir: mingw32 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup toolchain install --no-self-update stable-${{ matrix.target }} | |
rustup default stable-${{ matrix.target }} | |
- name: Check out MinGW toolchain | |
run: | | |
set -x | |
curl -sSf -O "${MINGW_URL}/${{ matrix.archive }}" | |
7z x -y "${{ matrix.archive }}" -o/c/mingw | |
rm "${{ matrix.archive }}" | |
echo "C:\mingw\${{ matrix.mingw_dir }}\bin" >> $GITHUB_PATH | |
shell: bash | |
if: matrix.mingw_dir | |
- 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: | |
# add_of_mut! requires for soundness | |
MSRV: 1.56.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup toolchain install --no-self-update ${{ env.MSRV }} | |
rustup default ${{ env.MSRV }} | |
- run: | | |
rustup run stable cargo generate-lockfile | |
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 toolchain install --no-self-update 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: | |
name: github-pages | |
path: target/doc | |
retention-days: 1 | |
deploy: | |
if: github.event_name != 'pull_request' && github.event.ref == 'refs/heads/master' | |
# 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 | |
# Deploy to the github-pages environment | |
# environment: | |
# name: github-pages | |
# url: ${{ steps.deployment.outputs.page_url }} | |
needs: [rustdoc] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: github-pages | |
clippy: | |
runs-on: windows-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
rustup toolchain install --no-self-update nightly -c clippy | |
rustup default nightly | |
- run: cargo clippy --all-targets --all-features -- -Dwarnings -A clippy::assertions-on-constants | |
# 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 toolchain install --no-self-update ${{ 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 |