-
Notifications
You must be signed in to change notification settings - Fork 26
119 lines (105 loc) · 3.26 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
name: Linting & Tests
on:
push:
branches:
- master
pull_request:
types:
- assigned
- unassigned
- labeled
- unlabeled
- opened
- edited
- reopened
- synchronize
- ready_for_review
- locked
- unlocked
- review_requested
- review_request_
workflow_dispatch:
jobs:
lint:
name: 🕵️ Linting Check
runs-on: ubuntu-latest
# don't run workflow if pr draft
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
echo "testing: ${{github.ref}}"
python -m pip install --upgrade pip
pip install .[dev]
pip install -r requirements_dev.txt
- name: Lint
run: |
black . --check
tests:
needs: lint
name: 🤖 Tests (${{ matrix.python-version }})
runs-on: "ubuntu-latest"
# don't run workflow if pr draft
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.9"]
steps:
- uses: actions/checkout@v2
#setup miniconda
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: stytra_env
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
# install linux libraries for display server
- name: Install Linux libraries
run: |
sudo apt-get install -y libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
sudo apt-get update -qq
sudo apt install libxcb-xinerama0
sudo apt-get install -qq --no-install-recommends \
libxml2-dev libxslt1-dev gfortran libatlas-base-dev \
libespeak1 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 \
libxkbcommon-x11-0 libxcb-icccm4 libxcb1 openssl \
libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
libxcb-shape0-dev libxcb-xkb-dev xvfb \
libopengl0 libegl1 \
libpulse0 libpulse-mainloop-glib0 \
gir1.2-gtk-3.0 libgirepository1.0-dev
#check the conda info
- name: Conda info
shell: bash -l {0}
run: conda info
#Initialize conda env
- name: Init
shell: bash -l {0}
run: conda init
#Install the dependencies in stytra env
- name: Dependencies
shell: bash -l {0}
run: |
conda activate stytra_env
python -m pip install --upgrade pip
pip install -r ./requirements_dev.txt
pip install .[dev]
#Create a server display
- name: Start display server
run: |
Xvfb :1 -screen 0 1024x768x16 &
echo "DISPLAY=:1.0" >> $GITHUB_ENV
#Start testing (forked makes sure each test is run in a separate process)
- name: Test all
shell: bash -l {0}
run: |
conda activate stytra_env
pytest -n3 --forked