Skip to content

Commit

Permalink
DEV - Add build check and test release workflow (#636)
Browse files Browse the repository at this point in the history
  • Loading branch information
trallard authored Oct 20, 2023
1 parent e26552c commit 173a95c
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/new-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
94 changes: 77 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ Flexible. Reproducible. Governable.

<div align="center">

<a href="https://conda-store.readthedocs.io/en/latest/">
<img src="https://readthedocs.org/projects/conda-store/badge/?version=latest" alt="Documentation Status"/>
</a>

<a href="https://pypi.org/project/conda-store-server/">
<img src="https://img.shields.io/pypi/v/conda-store-server?label=pypi|conda-store-server" alt="PyPi"/>
</a>
Expand Down
2 changes: 1 addition & 1 deletion conda-store-server/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion conda-store-server/conda_store_server/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2023.10.1"
__version__ = "2023.10.1-rc-1"
4 changes: 4 additions & 0 deletions conda-store-server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
2 changes: 1 addition & 1 deletion conda-store/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion conda-store/conda_store/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2023.10.1"
__version__ = "2023.10.1-rc-1"

0 comments on commit 173a95c

Please sign in to comment.