Skip to content

add pre-commit config #112

add pre-commit config

add pre-commit config #112

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ['**']
paths-ignore:
- '**/*.md'
pull_request: {branches: [main]}
defaults: {run: {shell: 'bash -el {0}'}} # https://github.com/marketplace/actions/setup-miniconda#important
env:
YARDL_VERSION: 0.6.2
jobs:
validate:
strategy:
matrix:
cppVersion: [17]
environment: pypi
permissions: {id-token: write}
name: Validate Python and C++${{ matrix.cppVersion }} and deploy to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {submodules: recursive}
- name: strip environment.yml
run: |
cat environment.yml | grep -v "#.*\<\local\>" > temp-ci-environment.yml
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: yardl
environment-file: temp-ci-environment.yml
- name: Install yardl
run: |
rm temp-ci-environment.yml
gh release download -R microsoft/yardl -p '*linux_x86_64.tar.gz' v$YARDL_VERSION
mkdir yardl
tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" -C yardl
rm "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz"
echo "$PWD/yardl" >> "$GITHUB_PATH"
env:
GH_TOKEN: ${{ github.token }}
- name: Build model
run: |
cd model
yardl generate
- name: Python
run: |
cd python
python petsird_generator.py | python petsird_analysis.py
- name: cpp
run: |
mkdir cpp/build
cd cpp/build
cmake -G Ninja -S .. -DHDF5_ROOT="$CONDA_PREFIX"
ninja
./petsird_generator test.h5
./petsird_analysis test.h5
- name: Copy LICENSE for deployment
run: |
cp LICENSE.txt python/LICENSE
cp LICENSE.txt cpp/LICENSE
- uses: casperdcl/deploy-pypi@v2
with:
build: python -o dist
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- uses: actions/upload-artifact@v4
with:
name: python-petsird
path: dist/**