Add a simulation unit system class (#392) #510
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
check_skip_flags: | |
name: Check skip flags | |
runs-on: ubuntu-latest | |
outputs: | |
head-commit-message: ${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.GITHUB_SHA }} | |
- name: Get head commit message | |
id: get_head_commit_message | |
run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" | |
tests: | |
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with numpy ${{ matrix.numpy-version }}, no gsl ${{ matrix.gala-nogsl }}, deps ${{ matrix.pip-test-deps }} | |
runs-on: ${{ matrix.os }} | |
needs: check_skip_flags | |
if: ${{ github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'docs only') && !contains(needs.check_skip_flags.outputs.head-commit-message, '[skip tests]') }} | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
os: ["ubuntu-latest", "macos-latest"] | |
numpy-version: ["latest"] | |
gala-nogsl: ["0"] | |
pip-test-deps: ["test"] | |
include: | |
- name: Oldest numpy version supported | |
os: ubuntu-latest | |
python-version: "3.11" | |
numpy-version: "1.24" | |
gala-nogsl: "0" | |
pip-test-deps: "test" | |
- name: Install without GSL | |
os: ubuntu-latest | |
python-version: "3.11" | |
numpy-version: "latest" | |
gala-nogsl: "1" | |
pip-test-deps: "test" | |
- name: With optional dependencies | |
os: ubuntu-latest # note: galpy install failed on macos here | |
python-version: "3.11" | |
numpy-version: "latest" | |
gala-nogsl: "0" | |
pip-test-deps: "test,extra" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
# For animation tests | |
- uses: FedericoCarboni/setup-ffmpeg@v3 | |
if: ${{ !startsWith(matrix.os, 'mac') }} | |
continue-on-error: true | |
with: | |
# Not strictly necessary, but it may prevent rate limit | |
# errors especially on GitHub-hosted macos machines. | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
ffmpeg-version: "6.1.0" | |
id: setup-ffmpeg | |
# Mac: | |
- name: Setup Mac - GSL | |
if: startsWith(matrix.os, 'mac') | |
run: | | |
brew install gsl | |
# Ubuntu: | |
- name: Setup Linux - GSL | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install gsl-bin libgsl0-dev build-essential | |
sudo apt-get install libhdf5-serial-dev # TODO: remove when h5py has 3.11 wheels | |
- name: Install package and dependencies | |
run: python -m pip install -e ".[${{ matrix.pip-test-deps }}]" | |
env: | |
GALA_NOGSL: ${{ matrix.gala-nogsl }} | |
- name: Update versions if testing min versions | |
if: matrix.numpy-version != 'latest' | |
run: | | |
python -m pip install numpy~=${{ matrix.numpy-version }} | |
- name: Run tests | |
run: >- | |
python -m pytest -ra --cov --cov-report=xml --cov-report=term | |
--durations=20 . | |
- name: Upload coverage report | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |