Merge pull request #392 from glotzerlab/update-doc-builds #106
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: | |
pull_request: | |
push: | |
branches: | |
- "trunk-*" | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
unit_test: | |
name: Unit test [py${{ matrix.python }} ${{ matrix.c_compiler }} ${{ matrix.os }}] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
############## | |
# Windows | |
- os: windows-2019 | |
python: '3.12' | |
- os: windows-2022 | |
python: '3.13.0-rc.1' | |
############## | |
# Mac | |
# macos-x86_64 | |
- os: macos-13 | |
python: '3.12' | |
# macos-arm64 | |
- os: macos-14 | |
python: '3.13.0-rc.1' | |
############## | |
# Ubuntu 24.04 | |
- os: ubuntu-24.04 | |
python: '3.10' | |
c_compiler: gcc-14 | |
cxx_compiler: g++-14 | |
- os: ubuntu-24.04 | |
python: '3.11' | |
c_compiler: clang-16 | |
cxx_compiler: clang++-16 | |
- os: ubuntu-24.04 | |
python: '3.12' | |
c_compiler: clang-17 | |
cxx_compiler: clang++-17 | |
- os: ubuntu-24.04 | |
python: '3.12' | |
c_compiler: clang-18 | |
cxx_compiler: clang++-18 | |
- os: ubuntu-24.04 | |
python: '3.13.0-rc.1' | |
c_compiler: clang-18 | |
cxx_compiler: clang++-18 | |
############## | |
# Ubuntu 22.04 | |
- os: ubuntu-22.04 | |
python: '3.10' | |
c_compiler: gcc-12 | |
cxx_compiler: g++-12 | |
- os: ubuntu-22.04 | |
python: '3.11' | |
c_compiler: clang-13 | |
cxx_compiler: clang++-13 | |
- os: ubuntu-22.04 | |
python: '3.12' | |
c_compiler: clang-14 | |
cxx_compiler: clang++-14 | |
- os: ubuntu-22.04 | |
python: '3.12' | |
c_compiler: clang-15 | |
cxx_compiler: clang++-15 | |
############## | |
# Ubuntu 20.04 | |
- os: ubuntu-20.04 | |
python: '3.10' | |
c_compiler: clang-10 | |
cxx_compiler: clang++-10 | |
- os: ubuntu-20.04 | |
python: '3.11' | |
c_compiler: clang-11 | |
cxx_compiler: clang++-11 | |
- os: ubuntu-20.04 | |
python: '3.12' | |
c_compiler: clang-12 | |
cxx_compiler: clang++-12 | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
path: code | |
- name: Set up Python | |
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Set up Python environment | |
uses: glotzerlab/workflows/setup-uv@ae7e7c6931098a313ef8069ef04b88a55c3a40f6 # 0.3.0 | |
with: | |
lockfile: "code/.github/requirements-test.txt" | |
- name: Set Linux compiler | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: | | |
echo "CC=${{ matrix.c_compiler }}" >> "$GITHUB_ENV" | |
echo "CXX=${{ matrix.cxx_compiler }}" >> "$GITHUB_ENV" | |
- name: Configure | |
run: cmake -S code -B build | |
- name: Build | |
run: cmake --build build -j 6 --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 | |
if: always() | |
needs: [unit_test] | |
runs-on: ubuntu-latest | |
steps: | |
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' | |
- name: Done | |
run: exit 0 |