Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic test matrix #90

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ on:
- main

jobs:
test-api:

api:
name: API
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -33,43 +32,51 @@ jobs:
run: |
pytest -n 4 --ignore=tests/test_repositories_plus.py --ignore=tests/test_repositories.py

test-repositories:
prepare:
name: Prepare test repositories
runs-on: ubuntu-latest
outputs:
repository: ${{ steps.load.outputs.repository }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: load test repositories
id: load
run: |
python -c "import tomllib; r = tomllib.loads(open('tests/test_repositories.toml').read());print('repository=' + str({'repository': list(r.keys())}))" >> "$GITHUB_OUTPUT"

repository:
name: Repository
needs: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service: ["zenodo", "dataverse", "figshare", "djehuty", "dryad", "osf", "mendeley", "dataone", "dspace", "pangaea", "github"]
python-version: ["3.8", "3.12"]

matrix: ${{ fromJson(needs.prepare.outputs.repository) }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[test]"
- name: Test with pytest
run: |
pytest tests/test_repositories.py --service ${{ matrix.service }}

test-repositories-plus:
pytest tests/test_repositories.py --service ${{ matrix.repository }}

repositories-plus:
name: Repositories plus
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
Loading