Skip to content

Fix API docs URL

Fix API docs URL #147

Workflow file for this run

# Adapted from https://github.com/snok/install-poetry#testing-using-a-matrix
name: build and test
on: pull_request
jobs:
linting:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
#----------------------------------------------
# load pip cache if cache exists
#----------------------------------------------
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
#----------------------------------------------
# install and run linters
#----------------------------------------------
- run: python -m pip install black flake8 isort
- run: flake8 .
- run: black . --check
- run: isort .
test:
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.10"]
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# run type checking and test suite
#----------------------------------------------
- name: Run tests
run: |
source .venv/bin/activate
pyright chai/ tests/ integration-tests/
pytest -s tests/
integration:
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.8", "3.10"]
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
# checkout repo and git submodules
#----------------------------------------------
- uses: actions/checkout@v2
with:
# We need non-shallow git clone for nix
fetch-depth: 0
# We need the apalache code base git submodule for the integration tests
submodules: "recursive"
#----------------------------------------------
# set up cache for scala & java deps
#----------------------------------------------
- name: Cache local m2 repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-sbt-${{ hashFiles('apalache/project/Dependencies.scala') }}
restore-keys: |
${{ runner.os }}-sbt-
${{ runner.os }}-
#----------------------------------------------
# install and set up nix
#----------------------------------------------
- name: Cache nix store
# Workaround for cache action not playing well with permissions
# See https://github.com/actions/cache/issues/324
uses: john-shaffer/cache@59429c0461095f341a8cf7388e5d3aef37b95edd
with:
path: |
/nix/store
/nix/var/nix/profiles
key: ${{ runner.os }}-nix-${{ hashFiles('**.nix') }}
restore-keys: |
${{ runner.os }}-nix-
${{ runner.os }}-
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
#----------------------------------------------
# build Apalache
#----------------------------------------------
- name: Build Apalache
run: make apalache
#----------------------------------------------
# set up python
#----------------------------------------------
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# run integration tests
#----------------------------------------------
- name: Run integration tests
run: |
source .venv/bin/activate
# Ensure Apalache is in the PATH
source .envrc
pytest -s integration-tests/