From b8e93a0d36056360cdaa5b231dd81a0eb4d34b1c Mon Sep 17 00:00:00 2001 From: dougiesquire Date: Thu, 18 Jan 2024 09:28:08 +1100 Subject: [PATCH] add full test build workflow to CI --- .github/workflows/CD.yml | 2 ++ .github/workflows/CI.yml | 47 +++++++++++++++++++++++++++++++++++----- conda/meta.yaml | 4 +++- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 2b94c676..d9ed850f 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -63,6 +63,8 @@ jobs: show-channel-urls: true - name: Build and upload the conda package + env: + PYPI_URL: https://pypi.io uses: uibcdf/action-build-and-upload-conda-packages@v1.2.0 with: meta_yaml_dir: conda diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index db3e050f..48afcc69 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: @@ -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 diff --git a/conda/meta.yaml b/conda/meta.yaml index e1f2ed8b..2cc2d177 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -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: