-
Notifications
You must be signed in to change notification settings - Fork 94
102 lines (82 loc) · 2.61 KB
/
test.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
name: Validate Pull Request
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Do sanity check once on Ubuntu with Python 3.9 and test on the rest
sanityCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Validate poetry configuration
run: poetry check
- name: Validate styling
run: |
pip install pylint
poetry run pylint **/*.py
# Test on all supported Python versions and OSes
test_x86:
needs: sanityCheck
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --no-interaction
- name: Run tests
run: poetry run pytest
# Test on ARM using docker containers
test_arm_linux:
needs: sanityCheck
runs-on: self-hosted-arm-linux
container:
image: ${{ matrix.docker-image }}
strategy:
fail-fast: false
matrix:
docker-image: ['python:3.8-bullseye', 'python:3.9-bullseye', 'python:3.10-bullseye']
steps:
# See: https://github.com/actions/runner/issues/2193
- name: Pre clean up the home dir with poetry cache
run: |
rm -rf /github/home/.cache/
rm -rf /github/home/.local/
- uses: actions/checkout@v2
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.6 python3 -
echo "/github/home/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
poetry install --no-interaction
- name: Run tests
run: poetry run pytest
- name: Post clean up the home dir with poetry cache
run: |
rm -rf /github/home/.cache/
rm -rf /github/home/.local/