Skip to content

Add GitHub Actions Testing #4

Add GitHub Actions Testing

Add GitHub Actions Testing #4

Workflow file for this run

---
name: Run Unit Tests
on:
# run at 8am every Monday morning
schedule:
- cron: '0 8 * * 1'
# run with each new Pull Request opened to the main branch
pull_request:
branches:
- main
jobs:
runscript:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# update list with desired Python versions to test
python-version: ["3.12"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Register hydrodata credentials as a public user
env:
TEST_EMAIL_PUBLIC: ${{ secrets.TEST_EMAIL_PUBLIC }}
TEST_PIN_PUBLIC: ${{ secrets.TEST_PIN_PUBLIC }}
run: |
python utils/set_credentials.py --public
- name: Run public-access unit tests with pytest
run: |
pytest tests/hf_hydrodata -m "not private_dataset"
- name: Register hydrodata credentials as a user with private dataset access
env:
TEST_EMAIL_PRIVATE: ${{ secrets.TEST_EMAIL_PRIVATE }}
TEST_PIN_PRIVATE: ${{ secrets.TEST_PIN_PRIVATE }}
run: |
python utils/set_credentials.py --private
# Run only the tests that require private dataset access level
- name: Run private-access unit tests with pytest
run: |
pytest tests/hf_hydrodata/test_gridded.py -m private_dataset