Build and Test with Coverage #2216
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: Build and Test with Coverage | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: # Build every day at 5PM UTC | |
- cron: '0 17 * * *' | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
test-book-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: install graphviz | |
run: sudo apt-get update && sudo apt-get -y install graphviz | |
- name: install mdbook | |
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.27/mdbook-v0.4.27-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=$HOME/.cargo/bin | |
- name: install link checker | |
run: | | |
curl -sSL https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v0.7.7/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip > mdbook-linkcheck.zip | |
mkdir -p $HOME/.cargo/bin | |
unzip mdbook-linkcheck.zip -d $HOME/.cargo/bin | |
chmod +x $HOME/.cargo/bin/mdbook-linkcheck | |
echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV" | |
- name: make book | |
run: make book | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
components: clippy | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: run clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --tests --no-deps --all-features --all-targets -- --warn clippy::pedantic -D warnings | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ macos-14, ubuntu-latest ] | |
rust: [ nightly ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: SetupEnv | |
run: | | |
echo "PATH=$GITHUB_WORKSPACE/target/debug:$PATH" >> "$GITHUB_ENV" | |
echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> "$GITHUB_ENV" | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
target: wasm32-unknown-unknown | |
- name: InstallLinuxDependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update && sudo apt-get -y install libzmq3-dev binaryen lcov | |
wget https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-linux.tar.gz | |
tar -xvzf binaryen-version_116-x86_64-linux.tar.gz | |
sudo cp binaryen-version_116/bin/* /bin/ | |
rm -rf binaryen-version_116 | |
rm binaryen-version_116-x86_64-linux.tar.gz | |
which wasm-opt | |
wasm-opt --version | |
- name: InstallMacDependencies | |
if: runner.os == 'macOS' | |
run: brew install zmq binaryen lcov | |
- name: InstallWasmTools | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: wasm-gc wasm-snip | |
- name: ConfigureCoverage | |
run: | | |
cargo install grcov | |
rustup component add llvm-tools-preview | |
echo RUSTFLAGS="-C instrument-coverage" >> "$GITHUB_ENV" | |
echo LLVM_PROFILE_FILE="flow-%p-%m.profraw" >> "$GITHUB_ENV" | |
- name: build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
- name: compile flowstdlib to WASM | |
run: target/debug/flowc -d -g -O flowstdlib | |
- name: compile flowrcli | |
run: target/debug/flowc flowr/src/bin/flowrcli | |
- name: compile flowrgui | |
run: target/debug/flowc flowr/src/bin/flowrgui | |
- name: test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --features "online_tests" | |
- name: test-examples | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --examples | |
- name: UploadCoverage | |
run: | | |
grcov . --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info | |
lcov --remove lcov.info 'target/debug/build/**' '**/errors.rs' '*tests/*' -o lcov.info | |
bash <(curl -s https://codecov.io/bash) -f lcov.info | |
rm -f lcov.info |