ci: set GEMINI_ROOT for PyGemini #666
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: ci | |
env: | |
GEMINI_CIROOT: ~/ci | |
CMAKE_BUILD_TYPE: Release | |
CMAKE_INSTALL_PREFIX: ~/libgem | |
GEMINI_ROOT: ~/libgem | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
# GEMINI_ROOT is used to find Gemini3D by PyGemini | |
on: | |
push: | |
paths: | |
- "**.py" | |
- ".github/workflows/ci.yml" | |
- "src/gemini3d/libraries.json" | |
- "!scripts/**" | |
- "!example/**" | |
- "!Examples/**" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
include: | |
- os: macos-latest | |
python-version: "3.12" | |
- os: windows-latest | |
python-version: "3.12" | |
name: Lint ${{ matrix.os }} Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: python -m pip install -e .[lint] | |
timeout-minutes: 2 | |
- run: flake8 | |
- run: mypy | |
linux-macos: | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest] | |
include: | |
- os: macos-latest | |
python-version: '3.12' | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }} Python ${{ matrix.python-version }} | |
env: | |
FC: gfortran-13 | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout GemGI (for simulation config.nml inputs) | |
uses: actions/checkout@v4 | |
with: | |
repository: gemini3d/gemci | |
path: ${{ github.workspace }}/gemci | |
- name: Install Prereqs (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update | |
sudo apt install --no-install-recommends libopenmpi-dev openmpi-bin libhdf5-dev ninja-build | |
- name: Install Prereqs (Macos) | |
if: runner.os == 'macOS' | |
run: brew install ninja open-mpi hdf5 scalapack | |
- name: Cache install Gemini3D | |
id: cache-gemini | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.CMAKE_INSTALL_PREFIX }} | |
key: ${{ runner.os }}-gemini-${{ hashFiles('gemini3d/CMakeLists.txt') }} | |
# weak check that gemini3d has changed since last cache update | |
- name: Checkout Gemini3D | |
if: steps.cache-gemini.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: gemini3d/gemini3d | |
path: gemini3d | |
- name: non-cache Install Gemini3D | |
if: steps.cache-gemini.outputs.cache-hit != 'true' | |
timeout-minutes: 15 | |
run: | | |
cmake -B build | |
cmake --build build | |
cmake --install build | |
working-directory: gemini3d | |
- name: Git Checkout ${{ github.action_repository }} | |
uses: actions/checkout@v4 | |
- name: Install Python packages | |
run: python -m pip install .[tests,plots] | |
timeout-minutes: 5 | |
# transient CI download speed | |
- name: Unit and Integration Tests | |
run: pytest | |
timeout-minutes: 15 | |
env: | |
GEMCI_ROOT: ${{ github.workspace }}/gemci | |
# codecov coverage | |
# - run: pip install codecov pytest-cov | |
# - run: pytest --cov --cov-report=xml | |
# - name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v1 |