Merge pull request #35 from openghg/add_paris_2409 #60
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: openghg_defs workflow | |
on: | |
push: | |
branches: [main, devel] | |
tags: | |
- "*" | |
pull_request: | |
branches: [main, devel] | |
jobs: | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Install dev requirements | |
run: | | |
pip install -r requirements-dev.txt | |
- name: Install package | |
run: | | |
pip install . | |
- name: Run tests | |
run: | | |
pytest . | |
release_pypi: | |
name: Build and publish Python distributions 📦 to PyPI and TestPyPI | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Install pypa/build | |
run: | | |
pip install --upgrade build | |
- name: Build a binary wheel and a source tarball | |
run: | | |
python -m build --sdist --wheel --outdir dist/ | |
- name: Publish distribution 📦 to Test PyPI | |
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
release_conda: | |
name: Build and publish conda package | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7 | |
with: | |
init-shell: bash | |
- name: Build the conda package | |
run: | | |
micromamba create -n openghg_build anaconda-client boa -c conda-forge -y | |
micromamba activate openghg_build | |
mkdir ${{ github.workspace }}/build | |
conda mambabuild --croot ${{ github.workspace }}/build recipes -c conda-forge | |
BUILD_DIR=${GITHUB_WORKSPACE}/build | |
BUILD=$(find "$BUILD_DIR" -name '*.tar.bz2') | |
anaconda --token "$ANACONDA_TOKEN" upload --user openghg "$BUILD" | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} |