-
Notifications
You must be signed in to change notification settings - Fork 167
73 lines (60 loc) · 1.97 KB
/
build.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
name: CI
on:
pull_request_target:
types:
- opened
- synchronize
push:
branches:
- master
permissions:
contents: read
jobs:
authorize:
name: Authorize
environment: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true
build-and-test:
needs: authorize # Require approval before running on forked pull requests
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Configure Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Install dependencies
run: |
sudo ethtool -K eth0 tx off rx off
sudo apt install bubblewrap
pip install --user --upgrade pip
pip install --user pipenv
cd env && ls -lha
- name: Run tests
run: |
if [ -f requirements.txt ]; then pipenv install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pipenv install -r requirements.txt-dev; fi
which python3
bwrap \
--ro-bind / / \
--bind $PWD $PWD \
--unshare-all \
--clearenv \
--setenv EXAMPLE VALUE \
pipenv run coverage run -m unittest
deactivate
- name: Run linting
run: pre-commit run --all-files
- if: ${{ matrix.python-version == '3.10' }}
name: Upload coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@3.1.4
- if: ${{ matrix.python-version == '3.10' }}
name: Build documentation
run: sphinx-build ./docs/source ./docs/build --keep-going -n -a -b html