-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (75 loc) · 2.17 KB
/
merge-tests.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
name: merge-tests
on:
pull_request:
branches:
- main
jobs:
check_changes:
runs-on: ubuntu-latest
outputs:
run_job: ${{ steps.check_files.outputs.run_job }}
steps:
- name: Checkout PyBADS
uses: actions/checkout@v3
with:
fetch-depth: 0
path: pybads
- name: Check for modified files
id: check_files
run: |
cd ./pybads
echo "=============== list modified files ==============="
git diff --name-only origin/main
echo "========== check paths of modified files =========="
git diff --name-only origin/main > files.txt
echo "run_job=false" >> $GITHUB_OUTPUT
changes=false
while IFS= read -r file
do
echo $file
if [[ ($file != pybads/*) && ($file != pyproject.toml) && ($file != setup.py) ]]; then
:
else
echo "Change in source files found, running tests."
echo "run_job=true" >> $GITHUB_OUTPUT
changes=true
break
fi
done < files.txt
if [ "$changes" = false ]; then
echo "No changes to source directory found, skipping tests."
fi
tests:
needs: check_changes
if: needs.check_changes.outputs.run_job == 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout PyBADS
uses: actions/checkout@v3
with:
path: pybads
- name: Checkout GPyReg
uses: actions/checkout@v3
with:
repository: acerbilab/gpyreg
path: gpyreg
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install PyBADS
run: |
cd ./pybads
python -m pip install -e .
- name: Install GPyReg
run: |
cd ./gpyreg
python -m pip install -e .
- name: Run tests
run: |
cd ./pybads
python -m pytest --reruns=5 -x -vv