Skip to content

Commit

Permalink
Split default linting and testing Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Nov 7, 2023
1 parent 45ae298 commit 9fed906
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:

env:
PYTEST_ADDOPTS: "--color=yes"
COVERAGE_PY_VERSION: "3.11" # The version of Python to use when running additional tests (typically the latest supported)
LINTING_PY_VERSION: "3.9" # The version of Python to use for linting (typically the minimum supported)

# Cancel running workflows when additional changes are pushed
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
Expand All @@ -26,10 +28,10 @@ jobs:
with:
submodules: true

- name: Set up Python 3.9
- name: Set up Python ${{ env.LINTING_PY_VERSION }}
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: ${{ env.LINTING_PY_VERSION }}
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand All @@ -56,10 +58,10 @@ jobs:
with:
submodules: true

- name: Set up Python 3.9
- name: Set up Python ${{ env.LINTING_PY_VERSION }}
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: ${{ env.LINTING_PY_VERSION }}
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand Down Expand Up @@ -227,27 +229,27 @@ jobs:
run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/adapters/

- name: Run tests for validator only to assess coverage (mongomock)
if: matrix.python-version == 3.9
if: matrix.python-version == '${{ env.COVERAGE_PY_VERSION }}'
run: pytest -rs --cov=./optimade/ --cov-report=xml:validator_cov.xml --cov-append tests/server/test_server_validation.py
env:
OPTIMADE_DATABASE_BACKEND: 'mongomock'

- name: Run tests for validator only to assess coverage (Elasticsearch)
if: matrix.python-version == 3.9
if: matrix.python-version == '${{ env.COVERAGE_PY_VERSION }}'
run: pytest -rs --cov=./optimade/ --cov-report=xml:validator_cov.xml --cov-append tests/server/test_server_validation.py
env:
OPTIMADE_DATABASE_BACKEND: 'elastic'
OPTIMADE_INSERT_TEST_DATA: false # Must be specified as previous steps will have already inserted the test data

- name: Run tests for validator only to assess coverage (MongoDB)
if: matrix.python-version == 3.9
if: matrix.python-version == '${{ env.COVERAGE_PY_VERSION }}'
run: pytest -rs --cov=./optimade/ --cov-report=xml:validator_cov.xml --cov-append tests/server/test_server_validation.py
env:
OPTIMADE_DATABASE_BACKEND: 'mongodb'
OPTIMADE_INSERT_TEST_DATA: false # Must be specified as previous steps will have already inserted the test data

- name: Run the OPTIMADE Client CLI
if: matrix.python-version == 3.9
if: matrix.python-version == '${{ env.COVERAGE_PY_VERSION }}'
run: |
coverage run --append --source optimade optimade/client/cli.py \
--filter 'nsites = 1' \
Expand Down Expand Up @@ -275,15 +277,15 @@ jobs:
coverage xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.9' && github.repository == 'Materials-Consortia/optimade-python-tools'
if: matrix.python-version == '${{ env.COVERAGE_PY_VERSION }}' && github.repository == 'Materials-Consortia/optimade-python-tools'
uses: codecov/codecov-action@v3
with:
name: project
file: ./coverage.xml
flags: project

- name: Upload validator coverage to Codecov
if: matrix.python-version == '3.9' && github.repository == 'Materials-Consortia/optimade-python-tools'
if: matrix.python-version == '${{ env.COVERAGE_PY_VERSION }}' && github.repository == 'Materials-Consortia/optimade-python-tools'
uses: codecov/codecov-action@v3
with:
name: validator
Expand All @@ -300,7 +302,7 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: ${{ env.LINTING_PY_VERSION }}
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand Down Expand Up @@ -330,10 +332,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python 3.9
- name: Set up Python ${{ env.LINTING_PY_VERSION }}
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: ${{ env.LINTING_PY_VERSION }}
cache: 'pip'
cache-dependency-path: |
requirements*.txt
Expand Down

0 comments on commit 9fed906

Please sign in to comment.