Skip to content

Reducing complexity of implementation in order to be able to add Atlas text search token based pagination #2731

Reducing complexity of implementation in order to be able to add Atlas text search token based pagination

Reducing complexity of implementation in order to be able to add Atlas text search token based pagination #2731

Workflow file for this run

name: testing
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade "pip<25.3"
pip install -r requirements/requirements-${{ matrix.os }}_py${{ matrix.python-version }}_extras.txt
pip install -e . --no-deps
- name: Set SSL_CERT_FILE (Linux)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "SSL_CERT_FILE=$(python -m certifi)" >> $GITHUB_ENV
- name: Set SSL_CERT_FILE (Windows)
if: matrix.os == 'windows-latest'
run: echo "SSL_CERT_FILE=$(python -m certifi)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Format API key name (Linux/MacOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
echo "API_KEY_NAME=$(echo ${{ format('MP_API_KEY_{0}_{1}', matrix.os, matrix.python-version) }} | awk '{gsub(/-|\./, "_"); print}' | tr '[:lower:]' '[:upper:]')" >> $GITHUB_ENV
- name: Format API key name (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "API_KEY_NAME=$(echo ${{ format('MP_API_KEY_{0}_{1}', matrix.os, matrix.python-version) }} | awk '{gsub(/-|\./, "_"); print}' | tr '[:lower:]' '[:upper:]')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Test with pytest
env:
MP_API_KEY: ${{ secrets[env.API_KEY_NAME] }}
#MP_API_ENDPOINT: https://api-preview.materialsproject.org/
run: |
pytest -n auto -x --cov=mp_api --cov-report=xml
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml