Skip to content

Commit

Permalink
template update
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Oct 20, 2023
1 parent 0cbcfc4 commit fc891c4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/ecmwf-projects/cookiecutter-conda-package",
"commit": "22b85d3aca63d05f4a19f1a531bcea311617f4cd",
"commit": "2efb5584faa681782a41bf2bb437295c5c0f4045",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
78 changes: 43 additions & 35 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ jobs:
- uses: actions/checkout@v4
- name: Install conda-merge
run: |
$CONDA/bin/python -m pip install conda-merge
python -m pip install conda-merge
- name: Combine environments
run: |
for SUFFIX in ci integration; do
$CONDA/bin/conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit
conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit
done
- name: Archive combined environments
uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v3
with:
name: combined-environments
path: ci/combined-environment-*.yml
Expand All @@ -57,13 +56,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download combined environments
uses: actions/download-artifact@v3
- uses: actions/download-artifact@v3
with:
name: combined-environments
path: ci
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
Expand All @@ -83,13 +80,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download combined environments
uses: actions/download-artifact@v3
- uses: actions/download-artifact@v3
with:
name: combined-environments
path: ci
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
Expand All @@ -109,13 +104,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download combined environments
uses: actions/download-artifact@v3
- uses: actions/download-artifact@v3
with:
name: combined-environments
path: ci
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/combined-environment-ci.yml
environment-name: DEVELOP
Expand Down Expand Up @@ -145,13 +138,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download combined environments
uses: actions/download-artifact@v3
- uses: actions/download-artifact@v3
with:
name: combined-environments
path: ci
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/combined-environment${{ matrix.extra }}.yml
environment-name: DEVELOP${{ matrix.extra }}
Expand All @@ -168,11 +159,6 @@ jobs:
distribution:
runs-on: ubuntu-latest
needs: [unit-tests, type-check, docs-build, integration-tests]
environment:
name: pypi
url: https://pypi.org/p/cacholote
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publish
if: |
always() &&
needs.unit-tests.result == 'success' &&
Expand All @@ -182,18 +168,40 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install packages
- name: Install package
run: |
$CONDA/bin/python -m pip install build twine
- name: Build distributions
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build distribution
run: |
$CONDA/bin/python -m build
python -m build
- name: Check wheels
run: |
cd dist || exit
$CONDA/bin/python -m pip install cacholote*.whl || exit
$CONDA/bin/python -m twine check * || exit
$CONDA/bin/python -c "import cacholote"
- name: Publish a Python distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
python -m pip install cacholote*.whl || exit
python -m twine check --strict * || exit
python -c "import cacholote" || exit
cd ..
- uses: actions/upload-artifact@v3
with:
name: distribution
path: dist

upload-to-pypi:
runs-on: ubuntu-latest
needs: distribution
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: pypi
url: https://pypi.org/p/cacholote
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publish

steps:
- uses: actions/download-artifact@v3
with:
name: distribution
path: dist
- uses: pypa/gh-action-pypi-publish@v1.8.10
with:
verbose: true

0 comments on commit fc891c4

Please sign in to comment.