Merge pull request #154 from g4edge/dependabot/github_actions/pypa/ci… #582
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: pyg4ometry | |
on: | |
push: | |
branches: | |
- main | |
- "releases/**" | |
pull_request: | |
release: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test: | |
name: Test with Python | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install non-pip dependencies on Ubuntu | |
if: runner.os == 'Linux' | |
run: sudo .github/bin/install-deps-ubuntu.sh | |
- name: Install non-pip dependencies on MacOS | |
if: runner.os == 'macOS' | |
run: .github/bin/install-deps-macos.sh | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Get dependencies and install pyg4ometry | |
run: | | |
python -m pip install --upgrade pip wheel setuptools | |
MAKEFLAGS=-j${{ steps.cpu-cores.outputs.count }} python -m pip install --upgrade --verbose .[test] | |
- name: Run unit tests | |
run: | | |
python -m pytest | |
test-in-container: | |
name: Test in Docker container | |
runs-on: ubuntu-latest | |
container: docker://g4edge/ubuntu:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Get dependencies and install pyg4ometry | |
run: | | |
python -m pip install --upgrade pip wheel setuptools | |
MAKEFLAGS=-j${{ steps.cpu-cores.outputs.count }} python -m pip install --upgrade --verbose .[test] | |
- name: Run unit tests | |
run: | | |
python -m pytest --runxfail | |
test-coverage: | |
name: Calculate and upload test coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Install non-pip dependencies on Ubuntu | |
run: | | |
sudo .github/bin/install-deps-ubuntu.sh | |
.github/bin/setenv-ubuntu.sh | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Generate Report | |
run: | | |
python -m pip install --upgrade pip wheel setuptools | |
MAKEFLAGS=-j${{ steps.cpu-cores.outputs.count }} python -m pip install --upgrade --verbose .[test] | |
python -m pytest --runxfail --cov=pyg4ometry --cov-report=xml | |
- name: Upload Coverage to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |