run on new tag #21
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 (build and test) | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: ["main"] | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-latest] | |
python-version: ["3.10", "3.11"] | |
exclude: | |
- os: macos-latest | |
python-version: '3.10' | |
name: "Core, Python ${{ matrix.python-version }}, ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Install package | |
run: python -m pip install -e .[dev] | |
- name: Regenerate the manifest | |
run: python src/lif_converters/dev/create_manifest.py | |
- name: Check if manifest has changed | |
run: | | |
if [ -n "$(git diff --exit-code ./src/lif_converters/__FRACTAL_MANIFEST__.json)" ]; then | |
echo "__FRACTAL_MANIFEST__.json has changed. Please run 'python src/lif_converters/dev/create_manifest.py' and commit the changes." | |
exit 1 | |
else | |
echo "__FRACTAL_MANIFEST__.json has not changed." | |
fi | |
- name: Test core library with pytest | |
run: python -m pytest tests | |
- name: Coverage | |
if: ${{ matrix.python-version == '3.10' }} && ${{ matrix.os == 'ubuntu-latest' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: /home/runner/work/fractal-lif-converters/fractal-lif-converters/coverage.xml | |
deploy: | |
name: Deploy | |
needs: tests | |
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule' | |
runs-on: ubuntu-latest | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing on PyPi | |
# see https://docs.pypi.org/trusted-publishers/ | |
id-token: write | |
# This permission allows writing releases | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 🐍 Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: 👷 Build | |
run: | | |
python -m pip install build | |
python -m build | |
- name: 🚢 Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
files: './dist/*' |