diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c265c0d8..41b478bd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: env: PYTEST_ADDOPTS: "--color=yes" + 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 @@ -26,10 +27,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 @@ -56,10 +57,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 @@ -184,25 +185,25 @@ jobs: pip install -r requirements-http-client.txt - name: Run non-server tests - run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml tests/ --ignore tests/server + run: pytest -rs -vvv --durations=0 --cov=./optimade/ --cov-report=xml tests/ --ignore tests/server - name: Install latest server dependencies run: pip install -r requirements-server.txt - name: Run server tests (using `mongomock`) - run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers + run: pytest -rs -vvv --durations=0 --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers env: OPTIMADE_DATABASE_BACKEND: 'mongomock' - name: Run server tests with no API validation (using `mongomock`) run: - pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers + pytest -rs -vvv --durations=0 --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers env: OPTIMADE_DATABASE_BACKEND: 'mongomock' OPTIMADE_VALIDATE_API_RESPONSE: false - name: Run server tests (using a real MongoDB) - run: pytest -rs -vvv --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers + run: pytest -rs -vvv --durations=0 --cov=./optimade/ --cov-report=xml --cov-append tests/server tests/filtertransformers env: OPTIMADE_DATABASE_BACKEND: 'mongodb' @@ -227,36 +228,38 @@ 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 == '3.11' 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 == '3.11' 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 == '3.11' 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 == '3.11' run: | coverage run --append --source optimade optimade/client/cli.py \ --filter 'nsites = 1' \ + --http-timeout 1.0 \ --output-file test_get_async.json \ https://optimade.fly.dev test test_get_async.json coverage run --append --source optimade optimade/client/cli.py \ --filter 'nsites = 1' \ + --http-timeout 1.0 \ --count \ --output-file test_count.json \ https://optimade.fly.dev @@ -265,6 +268,7 @@ jobs: coverage run --append --source optimade optimade/client/cli.py \ --no-async \ --filter 'nsites = 1' \ + --http-timeout 1.0 \ --count \ --output-file test_count_no_async.json \ https://optimade.fly.dev @@ -275,7 +279,7 @@ 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 == '3.11' && github.repository == 'Materials-Consortia/optimade-python-tools' uses: codecov/codecov-action@v3 with: name: project @@ -283,7 +287,7 @@ jobs: 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 == '3.11' && github.repository == 'Materials-Consortia/optimade-python-tools' uses: codecov/codecov-action@v3 with: name: validator @@ -300,7 +304,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 @@ -330,10 +334,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