-
-
Notifications
You must be signed in to change notification settings - Fork 138
66 lines (53 loc) · 1.65 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
name: Python CI
on:
pull_request:
branches:
- '**'
jobs:
run-ci:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
# TODO: add windows matrix
os: [macos-latest]
env:
REPO: ${{ github.event.pull_request.head.repo.full_name }}
BRANCH: ${{ github.event.pull_request.head.ref }}
SKIP_POETRY_SHELL: 1
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH }}
repository: ${{ env.REPO }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run tests using the shell script (macOS compatible).
if: matrix.os == 'macos-latest'
run: sh install/install_openadapt.sh
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- name: Activate virtualenv
run: source .venv/bin/activate
if: steps.cache-deps.outputs.cache-hit == 'true'
- name: Check formatting with Black
run: poetry run black --preview --check . --exclude '/(alembic|\.cache|\.venv|venv|contrib|__pycache__)/'
- name: Run Flake8
run: poetry run flake8 --exclude=alembic,.venv,venv,contrib,.cache,.git