-
Notifications
You must be signed in to change notification settings - Fork 39
79 lines (66 loc) · 2.4 KB
/
build-and-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
name: Build NAV and run full test suite
on: [push, pull_request]
jobs:
build-and-test:
name: "Test on Python ${{ matrix.python-version}}"
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: "Cache pip packages"
uses: actions/cache@v2
id: pip-cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: "Cache tox environments"
uses: actions/cache@v2
id: tox-cache
with:
path: .tox
key: ${{ runner.os }}-tox-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt', '**/requirements/*.txt', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-tox-${{ matrix.python-version }}-
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: "Set environment variables"
run: |
echo "WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "PGHOST=localhost" >> $GITHUB_ENV
echo "PGUSER=nav" >> $GITHUB_ENV
echo "PGPASSWORD=password" >> $GITHUB_ENV
- name: "Install test runner dependencies"
run: |
set -xe
python -m pip install --upgrade pip setuptools wheel tox tox-gh-actions coverage virtualenv snmpsim
- name: "Install libraries needed to build external dependencies"
run: |
set -xe
sudo apt-get install -y libldap2-dev libsasl2-dev libtidy5deb1 libsnmp35
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- uses: nanasess/setup-chromedriver@master
- name: "Set up PostgreSQL"
uses: harmon758/postgresql-action@v1
with:
postgresql version: '9.4' # minimum NAV requirement
postgresql user: $PGUSER
postgresql password: $PGPASSWORD
- name: "Run tests"
run: |
export DISPLAY=:99
python -m tox
- name: Upload Selenium driver logs (${{ matrix.python-version }})
if: always()
uses: actions/upload-artifact@v2
with:
name: pytest-logs
path: |
/tmp/pytest-of-runner