ci: update workflows #190
Workflow file for this run
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: Build and Test with Mamba | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Update environment.yaml with Python ${{ matrix.python-version }} | |
run: | | |
case "$(uname -s)" in | |
Darwin*) | |
sed -i '' "s/- python=3.9/- python=${{ matrix.python-version }}/" environment.yaml | |
;; | |
Linux*) | |
sed -i "s/- python=3.9/- python=${{ matrix.python-version }}/" environment.yaml | |
;; | |
esac | |
cat environment.yaml | |
- name: Set up Micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: 'latest' | |
environment-file: environment.yaml | |
init-shell: >- | |
bash | |
cache-environment: true | |
post-cleanup: 'all' | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
uv pip install . | |
- name: Cache build artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.micromamba/envs/mattersim | |
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ hashFiles('**/environment.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ matrix.python-version }}- | |
test: | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore build artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.micromamba/envs/mattersim | |
key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ hashFiles('**/environment.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ matrix.python-version }}- | |
- name: Set up Micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
micromamba-version: 'latest' | |
environment-file: environment.yaml | |
init-shell: >- | |
bash | |
cache-environment: true | |
post-cleanup: 'all' | |
- name: Install test dependencies | |
shell: bash -l {0} | |
run: | | |
uv pip install ".[dev]" | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
pytest -s tests |