Joss software release #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |