Skip to content

Commit

Permalink
simplify test actions with gacts/run-and-post-run
Browse files Browse the repository at this point in the history
  • Loading branch information
wenh06 committed Mar 20, 2024
1 parent 10f4011 commit a9ee3f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,22 @@ jobs:
python -m pip list
- name: Install nsrr and download a samll part of SHHS to do test
# ref. https://github.com/DeepPSP/nsrr-automate
run: |
gem install nsrr --no-document
nsrr download shhs/polysomnography/edfs/shhs1/ --file="^shhs1\-20010.*\.edf" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-nsrr/shhs1/ --file="^shhs1\-20010.*\-nsrr\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-profusion/shhs1/ --file="^shhs1\-20010.*\-profusion\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-rpoints/shhs1/ --file="^shhs1\-20010.*\-rpoint\.csv" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/ --shallow --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/hrv-analysis/ --token=${{ secrets.NSRR_TOKEN }}
mkdir -p ~/tmp/nsrr-data/
mv shhs/ ~/tmp/nsrr-data/
du -sh ~/tmp/nsrr-data/*
uses: gacts/run-and-post-run@v1
with:
run: |
gem install nsrr --no-document
nsrr download shhs/polysomnography/edfs/shhs1/ --file="^shhs1\-20010.*\.edf" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-nsrr/shhs1/ --file="^shhs1\-20010.*\-nsrr\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-profusion/shhs1/ --file="^shhs1\-20010.*\-profusion\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-rpoints/shhs1/ --file="^shhs1\-20010.*\-rpoint\.csv" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/ --shallow --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/hrv-analysis/ --token=${{ secrets.NSRR_TOKEN }}
mkdir -p ~/tmp/nsrr-data/
mv shhs/ ~/tmp/nsrr-data/
du -sh ~/tmp/nsrr-data/*
post: |
rm -rf ~/tmp/nsrr-data/
du -sh ~/tmp/nsrr-data/*
- name: Run test with pytest and collect coverage
run: |
pytest -v -s \
Expand All @@ -85,6 +90,3 @@ jobs:
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }} # required
- name: Remove downloaded NSRR data
run: |
rm -rf ~/tmp/nsrr-data/
30 changes: 16 additions & 14 deletions .github/workflows/test-databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,25 @@ jobs:
python -m pip list
- name: Install nsrr and download a samll part of SHHS to do test
# ref. https://github.com/DeepPSP/nsrr-automate
run: |
gem install nsrr --no-document
nsrr download shhs/polysomnography/edfs/shhs1/ --file="^shhs1\-20010.*\.edf" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-nsrr/shhs1/ --file="^shhs1\-20010.*\-nsrr\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-profusion/shhs1/ --file="^shhs1\-20010.*\-profusion\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-rpoints/shhs1/ --file="^shhs1\-20010.*\-rpoint\.csv" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/ --shallow --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/hrv-analysis/ --token=${{ secrets.NSRR_TOKEN }}
mkdir -p ~/tmp/nsrr-data/
mv shhs/ ~/tmp/nsrr-data/
du -sh ~/tmp/nsrr-data/*
uses: gacts/run-and-post-run@v1
with:
run: |
gem install nsrr --no-document
nsrr download shhs/polysomnography/edfs/shhs1/ --file="^shhs1\-20010.*\.edf" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-nsrr/shhs1/ --file="^shhs1\-20010.*\-nsrr\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-events-profusion/shhs1/ --file="^shhs1\-20010.*\-profusion\.xml" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/polysomnography/annotations-rpoints/shhs1/ --file="^shhs1\-20010.*\-rpoint\.csv" --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/ --shallow --token=${{ secrets.NSRR_TOKEN }}
nsrr download shhs/datasets/hrv-analysis/ --token=${{ secrets.NSRR_TOKEN }}
mkdir -p ~/tmp/nsrr-data/
mv shhs/ ~/tmp/nsrr-data/
du -sh ~/tmp/nsrr-data/*
post: |
rm -rf ~/tmp/nsrr-data/
du -sh ~/tmp/nsrr-data/*
- name: Run test SHHS with pytest
run: |
pytest -v -s test/test_databases/test_shhs.py
- name: Remove downloaded NSRR data
run: |
rm -rf ~/tmp/nsrr-data/
- name: Run test other databases with pytest
run: |
pytest -v -s test/test_databases/test_cachet_cadb.py
Expand Down

0 comments on commit a9ee3f3

Please sign in to comment.