-
Notifications
You must be signed in to change notification settings - Fork 26
146 lines (130 loc) · 4.13 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Tests
on:
push:
branches:
- master
pull_request:
schedule:
- cron: '0 6 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
env:
NO_ET: 1
DANDI_ALLOW_LOCALHOST_URLS: "1"
DANDI_PAGINATION_DISABLE_FALLBACK: "1"
DANDI_TESTS_PERSIST_DOCKER_COMPOSE: "1"
strategy:
fail-fast: false
matrix:
os:
- windows-2019
- ubuntu-latest
- macos-latest
python:
- 3.9
- '3.10' # Needs quotes so YAML doesn't think it's 3.1
- '3.11'
- '3.12'
mode:
- normal
include:
- os: ubuntu-latest
python: 3.9
mode: dandi-api
- os: ubuntu-latest
python: 3.9
mode: dev-deps
- os: ubuntu-latest
python: 3.9
mode: nfs
steps:
- name: Set up environment
uses: actions/checkout@v4
with:
# Fetch all commits so that versioneer will return something compatible
# with semantic-version
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install ".[extras,test]"
- name: Install dev versions of select dependencies
if: matrix.mode == 'dev-deps'
run: |
pip install git+https://github.com/jaraco/keyring
pip install git+https://github.com/NeurodataWithoutBorders/nwbinspector
pip install git+https://github.com/NeurodataWithoutBorders/pynwb
pip install git+https://github.com/hdmf-dev/hdmf
- name: Create NFS filesystem
if: matrix.mode == 'nfs'
run: |
mkdir /tmp/nfsmount_ /tmp/nfsmount
mkdir /tmp/nfsmount_/tmp /tmp/nfsmount_/home
echo "/tmp/nfsmount_ localhost(rw)" | sudo tee /etc/exports
sudo apt-get install -y nfs-kernel-server
sudo exportfs -a
sudo mount -t nfs localhost:/tmp/nfsmount_ /tmp/nfsmount
echo TMPDIR=/tmp/nfsmount/tmp >> "$GITHUB_ENV"
echo HOME=/tmp/nfsmount/home >> "$GITHUB_ENV"
echo DANDI_DEVEL_INSTRUMENT_REQUESTS_SUPERLEN=1 >> "$GITHUB_ENV"
- name: Use scheduled test configuration
if: github.event_name == 'schedule'
run: echo PYTEST_ADDOPTS=--scheduled >> "$GITHUB_ENV"
- name: Run all tests
if: matrix.mode != 'dandi-api'
run: |
python -m pytest -s -v --cov=dandi --cov-report=xml dandi
- name: Smoke test example code in docs
if: matrix.mode != 'dandi-api' && github.event_name == 'schedule'
run: |
set -ex
cd docs/source/examples
for f in *.py
do python "$f"
done
- name: Run Dandi API tests only
if: matrix.mode == 'dandi-api'
run: |
export DANDI_TESTS_AUDIT_CSV=/tmp/audit.csv
python -m pytest -s -v --cov=dandi --cov-report=xml --dandi-api dandi
if [ ! -e /tmp/audit.csv ]
then echo Audit file not created
exit 1
fi
lines="$(wc -l /tmp/audit.csv | awk '{print $1}')"
if [ "$lines" -lt 100 ]
then echo Audit file shorter than expected - only "$lines" lines
exit 1
fi
- name: Dump Docker Compose logs
if: failure() && startsWith(matrix.os, 'ubuntu')
run: |
docker compose \
-f dandi/tests/data/dandiarchive-docker/docker-compose.yml \
logs --timestamps
- name: Shut down Docker Compose
if: startsWith(matrix.os, 'ubuntu')
run: |
docker compose \
-f dandi/tests/data/dandiarchive-docker/docker-compose.yml \
down -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
# name: codecov-umbrella
# yml: ./codecov.yml
fail_ci_if_error: false