test.yml' #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs the complete test suite. | |
name: Tests | |
on: | |
push: | |
branches: [develop] | |
paths-ignore: ["**/*.md", docs/**] | |
pull_request: | |
branches: [develop] | |
paths-ignore: ["**/*.md", docs/**] | |
workflow_dispatch: | |
workflow_call: # make this workflow reusable by release.yml | |
permissions: | |
contents: read | |
jobs: | |
test: | |
# prevent this action from running on forks | |
if: github.repository == 'abinit/abipy' | |
defaults: | |
run: | |
shell: bash -l {0} # enables conda/mamba env activation by reading bash profile | |
strategy: | |
fail-fast: false | |
matrix: | |
# maximize CI coverage of different platforms and python versions while minimizing the | |
# total number of jobs. We run all pytest splits with the oldest supported python | |
# version (currently 3.9) on windows (seems most likely to surface errors) and with | |
# newest version (currently 3.12) on ubuntu (to get complete coverage on unix). | |
config: | |
- os: windows-latest | |
python: "3.9" | |
resolution: highest | |
extras: ci,optional | |
- os: ubuntu-latest | |
python: '>3.9' | |
resolution: highest | |
extras: ci,optional | |
- os: macos-latest | |
python: '3.10' | |
resolution: highest | |
extras: ci # test with only required dependencies installed | |
# pytest-split automatically distributes work load so parallel jobs finish in similar time | |
# update durations file with `pytest --store-durations --durations-path tests/files/.pytest-split-durations` | |
split: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
runs-on: ${{ matrix.config.os }} | |
#env: | |
# PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up micromamba | |
uses: mamba-org/setup-micromamba@main | |
- name: Create mamba environment | |
run: | | |
micromamba create -n abipy python=${{ matrix.config.python }} --yes | |
#- name: Install uv | |
# run: micromamba run -n abipy pip install uv | |
- name: Install pymatgen and dependencies | |
run: | | |
micromamba activate abipy | |
pip install --editable '.[${{ matrix.config.extras }}]' --resolution=${{ matrix.config.resolution }} | |
- name: pytest split ${{ matrix.split }} | |
run: | | |
micromamba activate abipy | |
pytest --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests |