Skip to content

Commit

Permalink
add full test build workflow to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dougiesquire committed Jan 17, 2024
1 parent 14bba8c commit b8e93a0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
show-channel-urls: true

- name: Build and upload the conda package
env:
PYPI_URL: https://pypi.io
uses: uibcdf/[email protected]
with:
meta_yaml_dir: conda
Expand Down
47 changes: 42 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,46 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
pypa-build:
name: PyPA build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: 3.11

- run: |
python3 -m pip install --upgrade build && python3 -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist

testpypi-publish:
needs: ['pypa-build']
name: Publish to TestPyPI.org
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
path: artifact/

- name: Publish package distributions to TestPyPI
# This is version v1.8.10
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
with:
packages_dir: artifact/
repository_url: https://test.pypi.org/legacy/
verbose: true

conda-build:
needs: ["testpypi-publish"]
if: always() && needs.testpypi-publish.result == 'success'
name: Conda Build
runs-on: ubuntu-latest
steps:
Expand All @@ -32,14 +71,12 @@ jobs:

- name: Run conda build
shell: bash -el {0}
# For the build, these environment variables would usually be set based on repo tags,
# but they can be these defaults instead since we don't use the build
env:
GIT_DESCRIBE_TAG: test
GIT_DESCRIBE_NUMBER: 0
PYPI_URL: https://test.pypi.org
run: conda build . --no-anaconda-upload

build:
test:
name: Tests
runs-on: ubuntu-latest

# Run the job for different versions of python
Expand Down
4 changes: 3 additions & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ build:
noarch: python
number: 0
script: "{{ PYTHON }} -m pip install . -vv"
script_env:
- PYPI_URL

source:
url: "https://pypi.io/packages/source/p/payu/payu-{{ version }}.tar.gz"
url: "{{ environ.get('PYPI_URL', 'https://pypi.io') }}/packages/source/p/payu/payu-{{ version }}.tar.gz"

requirements:
host:
Expand Down

0 comments on commit b8e93a0

Please sign in to comment.