-
Notifications
You must be signed in to change notification settings - Fork 2
185 lines (180 loc) · 7 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# 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/