Skip to content

[pre-commit.ci] pre-commit autoupdate #317

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #317

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ['**']
paths-ignore:
- '**/*.md'
pull_request: {branches: [main]}
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
defaults: {run: {shell: 'bash -el {0}'}} # https://github.com/marketplace/actions/setup-miniconda#important
env:
YARDL_VERSION: 0.6.3
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: {fetch-depth: 0, 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 }}
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session if triggered
#if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 30
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled == 'true' }}
- name: Build model
run: |
just generate
- name: Python
run: |
just run-python
- name: cpp
run: |
mkdir cpp/build
cd cpp/build
cmake -G Ninja -S .. -DHDF5_ROOT="$CONDA_PREFIX"
ninja
cd ../..
just run-cpp
- 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') }}
requirements: 'build twine packaging>=24.2' # https://github.com/pypa/twine/issues/1216
- uses: actions/upload-artifact@v4
with:
name: python-petsird
path: dist/**