Merge pull request #362 from glotzerlab/dependabot-pip-trunk-patch-pi… #842
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
name: Unit test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
# Trigger on pull requests. | |
pull_request: | |
# Trigger on pushes to the mainline branches and version tags. This prevents building commits | |
# twice when the pull request source branch is in the same repository. | |
push: | |
branches: | |
- "trunk-patch" | |
- "trunk-minor" | |
- "trunk-major" | |
# Trigger on request. | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
unit_test_linux: | |
name: Unit test on Linux [${{ matrix.image }}] | |
runs-on: ubuntu-latest | |
container: | |
image: glotzerlab/ci:2023.10.09-${{ matrix.image }} | |
options: -u 0 | |
strategy: | |
matrix: | |
image: [gcc13_py312, | |
clang14_py311, | |
clang13_py310, | |
clang12_py310, | |
gcc12_py311, | |
gcc11_py310, | |
clang11_py310, | |
gcc10_py310, | |
gcc9_py39, | |
clang10_py38] | |
steps: | |
- uses: actions/checkout@v4.1.2 | |
with: | |
path: code | |
- name: Configure | |
run: mkdir -p build && cd build && cmake ../code -GNinja | |
- name: Build | |
run: ninja | |
working-directory: build | |
- name: Run tests | |
run: python3 -m pytest --pyargs gsd -p gsd.pytest_plugin_validate --validate -v --log-level=DEBUG | |
env: | |
PYTHONPATH: ${{ github.workspace }}/build | |
unit_test_other: | |
name: Unit test on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-12, macos-14, windows-2019, windows-2022] | |
steps: | |
- uses: actions/checkout@v4.1.2 | |
with: | |
path: code | |
- name: Set up Python | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: '3.11' | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo dir="$(pip cache dir)" >> "$GITHUB_OUTPUT" | |
- uses: actions/cache@v4.0.2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: gsd-unit-test-${{ matrix.os }}-pip-${{ hashFiles('code/.github/requirements-test.txt') }} | |
restore-keys: | | |
gsd-unit-test-${{ matrix.os }}-pip- | |
- name: Install prereqs | |
run: python3 -m pip install -r code/.github/requirements-test.txt | |
- name: Configure | |
run: cmake -S code -B build | |
- name: Build | |
run: cmake --build build -j 4 --config Release | |
- if: runner.os == 'Windows' | |
name: Copy pyd files | |
run: cp ./gsd/Release/*.pyd gsd/ | |
working-directory: build | |
- name: Run tests | |
run: python3 -m pytest --pyargs gsd -p gsd.pytest_plugin_validate --validate -v --log-level=DEBUG | |
env: | |
PYTHONPATH: ${{ github.workspace }}/build | |
# This job is used to provide a single requirement for branch merge conditions. | |
tests_complete: | |
name: Unit test | |
needs: [unit_test_linux, unit_test_other] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Done!" |