Skip to content

Expose simulation parameters #187

Expose simulation parameters

Expose simulation parameters #187

Workflow file for this run

name: opencosmo CI
on:
pull_request:
branches:
- main
paths:
'**/*.py'
push:
branches:
- main
paths:
'**/*.py'
jobs:
lint-typecheck:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: setup mpi
uses: mpi4py/setup-mpi@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: setup mpi
uses: mpi4py/setup-mpi@v1
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: check pyproject.toml
run: cat pyproject.toml
- name: Install dependencies
run: poetry install --with develop,mpi
- name: Run ruff linter
run: poetry run ruff check .
- name: Run mypy type checker
run: poetry run mypy opencosmo
build-docs:
needs: lint-typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs"
get-test-data:
runs-on: ubuntu-latest
steps:
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.TEST_DATA_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.TEST_DATA_SECRET_KEY }}
aws-region: us-west-2
- name: check if cache exists
id: check-cache
uses: actions/cache@v4
with:
path: test_data.tar.gz
key: test-data
lookup-only: true
restore-keys: |
test-data
- name: Download test data
if: steps.check-cache.outputs.cache-hit != 'true'
run: aws s3 cp s3://${{ secrets.TEST_DATA_BUCKET }}/test_data.tar.gz test_data.tar.gz
- name: Cache test data
if: steps.check-cache.outputs.cache-hit != 'true'
id: cache-test-data
uses: actions/cache@v4
with:
path: test_data.tar.gz
key: test-data
enableCrossOsArchive: true
run-tests:
name: Run tests
runs-on: ${{ matrix.os }}
needs: [get-test-data]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11', '3.12', '3.13']
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: get test data
uses: actions/cache@v4
with:
path: test_data.tar.gz
key: test-data
enableCrossOsArchive: true
- name: Unpack test data
run: |
mkdir -p test/resource
tar -xzf test_data.tar.gz -C test/resource
- name: install poetry
run: pipx install poetry
- name: install python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: poetry install --with test
- name: Run tests with pytest
run: |
poetry run pytest --ignore=test/parallel
env:
OPENCOSMO_DATA_PATH : ${{ github.workspace }}/test/resource
run-parallel-tests:
runs-on: ubuntu-latest
needs: [get-test-data]
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: setup mpi
uses: mpi4py/setup-mpi@v1
- name: install parallel hdf5
run: sudo apt install -y libhdf5-mpi-dev
- name: get test data
uses: actions/cache@v4
with:
path: test_data.tar.gz
key: test-data
enableCrossOsArchive: true
- name: Unpack test data
run: |
mkdir -p test/resource
tar -xzf test_data.tar.gz -C test/resource
- name: install poetry
run: pipx install poetry
- name: install python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: build hdf5 in paralell
run: |
CC="mpicc" HDF5_MPI="ON" poetry run pip install --no-binary=h5py h5py
- name: install project
run: poetry install --with test,mpi,test-mpi
- name: get number of cores
run: echo "Running on $(nproc) cores"
- name: Run tests with pytest
run: |
poetry run mpiexec --use-hwthread-cpus -n 4 pytest -m parallel test/parallel
env:
OPENCOSMO_DATA_PATH : ${{ github.workspace }}/test/resource
build:
name: build
runs-on: ubuntu-latest
needs: [run-tests, run-parallel-tests, lint-typecheck]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Build package
run: poetry build