Test #887
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: Test | |
on: | |
push: | |
schedule: | |
# trigger weekly at 12am | |
# this build should run with caches disabled | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
jobs: | |
security_scan: | |
name: Security Scan of Dependencies | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check Github Permissions | |
id: check-permissions | |
uses: scherermichael-oss/action-has-permission@master | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# this action needs write permnissions for the given Github token | |
- uses: actions-rs/audit-check@v1 | |
if: ${{ steps.check-permissions.outputs.has-permission }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build-and-test: | |
name: Build and Test on ${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
toolchain: [1.72.0] | |
os: [ubuntu-20.04, macos-11, windows-2019] | |
experimental: [false] | |
include: | |
- platform: Linux | |
os: ubuntu-20.04 | |
features: z3,boolector,kissat,varisat | |
- platform: MacOs | |
os: macos-11 | |
features: z3,boolector,kissat,varisat | |
- platform: Windows | |
os: windows-2019 | |
features: z3,varisat | |
- platform: latest Rust | |
toolchain: stable | |
os: ubuntu-latest | |
# linter and format checkers are not executed for experimental platform | |
experimental: true | |
features: z3,boolector,kissat,varisat | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust ${{ matrix.toolchain }} | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
override: true | |
- name: Setup Windows Environment | |
if: ${{ contains(matrix.os, 'windows') }} | |
# MinGw64 and Git is already installed | |
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md | |
# Use gcc from cygwin for LP64 data model (not LLP64 with mingw) | |
run: | | |
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $env:GITHUB_ENV | |
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV | |
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV | |
choco upgrade cygwin -y --no-progress | |
# Workaround for Chocolatey 1.2.0, what we really want is: | |
# choco install gcc-core make -y --no-progress --source=cygwin | |
C:\tools\cygwin\cygwinsetup.exe -q -d -N -R C:\tools\cygwin -l C:\tools\cygwin\packages -P gcc-core,make | Out-Default | |
echo 'C:\tools\cygwin\bin' >> $env:GITHUB_PATH | |
- name: Check Github Permissions | |
id: check-permissions | |
uses: scherermichael-oss/action-has-permission@master | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Cargo Dependencies | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-cargo-dependencies | |
# disable cache for scheduled builds | |
# Unfortunately MacOs in combination with the Github Cache action has a bug: | |
# https://github.com/actions/virtual-environments/issues/2619 | |
# This is a workaround to fix curroption of cached cargo dependencies | |
if: ${{ github.event_name != 'schedule' && !contains(matrix.os, 'macos') }} | |
with: | |
# cargo cache files are stored in `~/.cargo` on Linux/macOS | |
# source for paths: https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target | |
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check Format | |
uses: actions-rs/cargo@v1 | |
if: ${{ !matrix.experimental }} | |
with: | |
command: fmt | |
args: -- --check | |
- name: Clippy | |
uses: actions-rs/clippy-check@v1 | |
# execute Clippy with Github integration for the target platform (Linux with fixed toolchain version) | |
# this action needs write permnissions for the given Github token | |
if: ${{ !matrix.experimental && contains(matrix.os, 'ubuntu') && steps.check-permissions.outputs.has-permission }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-targets --features ${{ matrix.features }} -- -D warnings | |
name: Clippy | |
- name: Clippy CLI | |
uses: actions-rs/cargo@v1 | |
# execute CLI-only version of Clippy for all platforms besides the target and the experimental platform | |
if: ${{ !matrix.experimental && (!contains(matrix.os, 'ubuntu') || !steps.check-permissions.outputs.has-permission) }} | |
with: | |
command: clippy | |
args: --all-targets --features ${{ matrix.features }} -- -D warnings | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --features ${{ matrix.features }} --locked | |
- name: Build Benchmarks | |
uses: actions-rs/cargo@v1 | |
with: | |
command: bench | |
args: --benches --no-run --features ${{ matrix.features }} --locked | |
- name: Doc | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --features ${{ matrix.features }} --locked | |
- name: Test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --features ${{ matrix.features }} --locked |