From 173a95c42b48c01356ec01dc79e66b6aa28b9ec6 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Fri, 20 Oct 2023 14:02:43 +0100 Subject: [PATCH] DEV - Add build check and test release workflow (#636) --- .github/ISSUE_TEMPLATE/new-release.md | 2 +- .github/workflows/release.yaml | 94 +++++++++++++++---- README.md | 4 - conda-store-server/README.md | 2 +- .../conda_store_server/__init__.py | 2 +- conda-store-server/pyproject.toml | 4 + conda-store/README.md | 2 +- conda-store/conda_store/__init__.py | 2 +- 8 files changed, 86 insertions(+), 26 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/new-release.md b/.github/ISSUE_TEMPLATE/new-release.md index dab34806d..171750ea2 100644 --- a/.github/ISSUE_TEMPLATE/new-release.md +++ b/.github/ISSUE_TEMPLATE/new-release.md @@ -60,4 +60,4 @@ Release captain responsible - <@gh_username> - [ ] If needed - update `meta.yaml` or `recipe.yaml` and re-render the feedstock. - [ ] Celebrate, you're done! 🎉 -[^github-activity]: If you wish, use [`github-activity` to generate a changelog](https://github.com/choldgraf/github-activity), e.g. `github-activity conda-incubator/conda-store --since 2023.9.1 --until 2023.10.1`. +[^github-activity]: If you wish, use [`github-activity` to generate a Changelog](https://github.com/choldgraf/github-activity), e.g. `github-activity conda-incubator/conda-store --since 2023.9.1 --until 2023.10.1`. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9ecbd4552..82c9c9cb3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,11 +1,14 @@ -name: "Release conda-store" +name: "Build and maybe upload PyPI package" on: release: - types: [created] + types: [published] push: + branches: [main] + tags: ["*"] + pull_request: branches: - - "*" + - main workflow_dispatch: env: @@ -15,10 +18,10 @@ permissions: contents: read # This is required for actions/checkout jobs: - pypi-release: + # Always build & verify package. + build-package: + name: Build & verify package runs-on: ubuntu-latest - permissions: - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing strategy: matrix: directory: @@ -30,30 +33,87 @@ jobs: steps: - name: "Checkout Repository 🛎" uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: "Set up Python 🐍" - uses: actions/setup-python@v4 + - run: echo "Running on ${{ matrix.directory }}" + + - name: "Check package build - ${{ matrix.directory }} 📦" + uses: hynek/build-and-inspect-python-package@v1 with: - python-version: 3.8 + path: ${{ matrix.directory }} + + # Adding a separate upload for publishing + - name: "Upload build artefacts 📤" + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.directory }}-package + path: | + /tmp/baipp/dist/*.whl + /tmp/baipp/dist/*.tar.gz + + # Upload to Test PyPI on every commit on main + release-test-pypi: + name: Publish in-dev to test.pypi.org + environment: release-test-pypi + if: github.repository_owner == 'conda-incubator' && github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: build-package + strategy: + matrix: + directory: + - "conda-store" + - "conda-store-server" - - name: "Install dependencies 📦" - run: | - pip install hatch twine + steps: + - name: "Download build artefacts 📥" + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.directory }}-package + path: dist - - name: "Build Package 📦" - run: | - hatch build - twine check dist/* + - name: "Upload package to Test PyPI" + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + print-hash: true + verbose: true + + + release-pypi: + name: Publish released package to pypi.org + environment: release-pypi + if: github.repository_owner == 'conda-incubator' && github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: build-package + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + strategy: + matrix: + directory: + - "conda-store" + - "conda-store-server" + defaults: + run: + working-directory: ${{ matrix.directory }} + + steps: + - name: "Download build artefacts 📥" + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.directory }}-package + path: dist - name: "Upload to PyPI 🚀" uses: pypa/gh-action-pypi-publish@release/v1 with: print-hash: true - if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') + verbose: true build_and_push_docker_image: name: "Build Docker Images 🛠" runs-on: ubuntu-latest + needs: release-pypi permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing strategy: diff --git a/README.md b/README.md index 38a01410c..0987a6000 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,6 @@ Flexible. Reproducible. Governable.
- - Documentation Status - - PyPi diff --git a/conda-store-server/README.md b/conda-store-server/README.md index fbcd9016a..262d21ea7 100644 --- a/conda-store-server/README.md +++ b/conda-store-server/README.md @@ -1,6 +1,6 @@ # conda-store server -[![Documentation Status](https://readthedocs.org/projects/conda-store/badge/?version=latest)](https://conda-store.readthedocs.io/en/latest/?badge=latest) +Check the full documentation at [conda.store](https://conda.store/). A multi-tenant server for managing Conda environments. See the [documentation](https://conda-store.readthedocs.io/en/latest/) for diff --git a/conda-store-server/conda_store_server/__init__.py b/conda-store-server/conda_store_server/__init__.py index b32942c0f..b31abaea4 100644 --- a/conda-store-server/conda_store_server/__init__.py +++ b/conda-store-server/conda_store_server/__init__.py @@ -1 +1 @@ -__version__ = "2023.10.1" +__version__ = "2023.10.1-rc-1" diff --git a/conda-store-server/pyproject.toml b/conda-store-server/pyproject.toml index 0a69234fa..448254afa 100644 --- a/conda-store-server/pyproject.toml +++ b/conda-store-server/pyproject.toml @@ -98,3 +98,7 @@ ignore = [ "E501", # line-length ] + +[tool.check-wheel-contents] +# ignore alembic migrations https://github.com/jwodder/check-wheel-contents?tab=readme-ov-file#w004--module-is-not-located-at-importable-path +ignore = ["W004"] diff --git a/conda-store/README.md b/conda-store/README.md index 8112cd78a..8d2719520 100644 --- a/conda-store/README.md +++ b/conda-store/README.md @@ -1,6 +1,6 @@ # conda-store -[![Documentation Status](https://readthedocs.org/projects/conda-store/badge/?version=latest)](https://conda-store.readthedocs.io/en/latest/?badge=latest) +Check the full documentation at [conda.store](https://conda.store/). A client library for interacting with a conda-store server. See the [documentation](https://conda-store.readthedocs.io/en/latest/) for diff --git a/conda-store/conda_store/__init__.py b/conda-store/conda_store/__init__.py index b32942c0f..b31abaea4 100644 --- a/conda-store/conda_store/__init__.py +++ b/conda-store/conda_store/__init__.py @@ -1 +1 @@ -__version__ = "2023.10.1" +__version__ = "2023.10.1-rc-1"