Adding initial obspack creation logic #2017
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 tests | |
on: | |
push: | |
branches: [master, devel] | |
tags: | |
- "*" | |
paths-ignore: | |
- 'CHANGELOG.md' | |
pull_request: | |
branches: [master, devel] | |
paths-ignore: | |
- 'CHANGELOG.md' | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Run the tests | |
runs-on: ${{ matrix.operating-system }} | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-latest] | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Format code with black | |
run: | | |
python -m pip install black | |
black --check openghg/ | |
- name: Lint with flake8 | |
run: | | |
python -m pip install --upgrade pip wheel setuptools flake8 | |
flake8 openghg/ --count --statistics | |
- name: Install openghg | |
run: | | |
pip install -r requirements-dev.txt | |
pip install . | |
- name: Run mypy | |
run: | | |
mypy --python-version ${{ matrix.python-version }} openghg/ | |
- name: Create mock cdsapi config file | |
run: | | |
echo $'url: https://www.openghg.org\nkey: 00000:f5690ad7-test-test-test-6fb0573991ca\n' > ~/.cdsapirc | |
- name: Install udunits package for CF compliance checks | |
run: | | |
sudo apt-get install libudunits2-0 | |
- name: Test with pytest | |
run: | | |
pip install --upgrade pytest | |
pytest -v --run-cfchecks | |
docs: | |
name: Build and deploy the documentation | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !contains(github.ref_name, '-') && contains(github.ref_name, '.') | |
runs-on: ubuntu-latest | |
needs: ["test"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Install openghg | |
run: | | |
pip install --upgrade pip wheel setuptools | |
pip install . | |
- name: Setup default config | |
run: openghg --default-config | |
- name: Install pandoc and requirements | |
run: | | |
sudo apt-get install -yq pandoc | |
pip install -r requirements-doc.txt | |
- name: Build documentation | |
run: | | |
cd doc | |
make | |
- name: Deploy to GitHub pages | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: "doc/build/html" | |
clean: true | |
release_pypi: | |
name: Build and publish Python distributions 📦 to PyPI and TestPyPI | |
runs-on: ubuntu-latest | |
needs: ["test", "docs"] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !contains(github.ref_name, '-') && contains(github.ref_name, '.') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
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@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 | |
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@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
release_conda: | |
name: Build and publish conda package | |
runs-on: ubuntu-latest | |
needs: ["test", "docs"] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !contains(github.ref_name, '-') && contains(github.ref_name, '.') | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1 | |
with: | |
init-shell: bash | |
- name: Build and push the conda package | |
run: | | |
micromamba create -n openghg_build anaconda-client boa conda-verify -c conda-forge | |
micromamba activate openghg_build | |
conda config --append channels openghg | |
mkdir ${{ github.workspace }}/build | |
conda mambabuild --croot ${{ github.workspace }}/build recipes -c conda-forge | |
env: | |
GIT_TAG: ${{ github.ref_name }} | |
- name: Publish build to Anaconda | |
run: | | |
micromamba activate openghg_build | |
BUILD_DIR=${GITHUB_WORKSPACE}/build | |
BUILD=$(find "$BUILD_DIR" -name '*.tar.bz2') | |
anaconda --token "$ANACONDA_TOKEN" upload --user openghg --label main "$BUILD" | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN_EXP_2025_08_14 }} | |
GIT_TAG: ${{ github.ref_name }} |