Skip to content

Generate paths as raw string literals #24

Generate paths as raw string literals

Generate paths as raw string literals #24

Workflow file for this run

name: Test
on:
push:
branches: 'master'
pull_request:
branches: 'master'
# Cancel previous runs in a PR when pushing new commits
concurrency:
group: worflow-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# Do not cancel when testing the master branch
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
env:
RUST_BACKTRACE: 1
PRUSTI_ASSERT_TIMEOUT: 60000
jobs:
# Check formatting
fmt-check:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Check formatting
run: |
rustup component add rustfmt
python ./x.py fmt-check-all
# Check that we depend on the compiler only through SMIR.
smir-check:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Check and report illegal extern crate.
run: |
python ./x.py check-smir
# Run clippy checks
clippy-check:
needs: [fmt-check, smir-check]
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Check and report Clippy errors
run: |
python ./x.py clippy -- -D warnings
# Run all the tests.
all-tests:
needs: [fmt-check, smir-check]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
PRUSTI_CACHE_PATH: ${{ github.workspace }}/prusti_cache.bin
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '15'
distribution: 'zulu'
- name: Set up the environment
run: python x.py setup
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: "shared"
- name: Prepare verification cache keys
shell: bash
run: |
VER_CACHE_KEY_SHARED=prusti-cache-$(cat viper-toolchain)-$(date +%Y-%m)
echo "VER_CACHE_KEY_SHARED=$VER_CACHE_KEY_SHARED" >> $GITHUB_ENV
echo "VER_CACHE_KEY_UNIQUE=$VER_CACHE_KEY_SHARED-${RANDOM}${RANDOM}" >> $GITHUB_ENV
- name: Load verification cache
uses: actions/cache@v3
with:
path: ${{ env.PRUSTI_CACHE_PATH }}
# Use a unique key, so that the job will always store the cache at the end of the run
key: ${{ env.VER_CACHE_KEY_UNIQUE }}
# Restore from the most recent cache that matches a shared prefix of the key
restore-keys: ${{ env.VER_CACHE_KEY_SHARED }}
- name: Build with cargo
run: python x.py build --all --jobs 1
- name: Run cargo tests
run: python x.py test --all --jobs 1
- name: Check prusti-contracts
run: |
cd prusti-contracts/prusti-contracts-test/
cargo +stable build
# Dummy job to specify the jobs that must pass before merging on master
can-merge:
runs-on: ubuntu-latest
needs: [clippy-check, all-tests]
# Always run, even if the workflow was cancelled
if: ${{ always() }}
steps:
- name: Fail if the workflow failed or was cancelled
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}