Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated GitHub Workflows #1139

Merged
merged 18 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'dependencies'
- title: '📚️ Documentation'
labels:
- 'documentation'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes

$CHANGES

$CONTRIBUTORS
4 changes: 2 additions & 2 deletions .github/scripts/get_example_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

DATASET_PATH = "angelolab/ark_example"

valid_configs = datasets.get_dataset_config_names(DATASET_PATH)
valid_configs = datasets.get_dataset_config_names(DATASET_PATH, trust_remote_code=True)

def load_dataset(cache_dir: Path, name: str):
_ = datasets.load_dataset(
Expand All @@ -25,4 +25,4 @@ def load_dataset(cache_dir: Path, name: str):

# Download all available datasets
for dataset_config in valid_configs:
load_dataset(cache_dir=cache_dir, name=dataset_config)
load_dataset(cache_dir=cache_dir, name=dataset_config)
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0


- name: Set up QEMU (For Linux ARM)
if: runner.os == 'Linux'
Expand All @@ -29,7 +30,7 @@ jobs:
platforms: arm64

- name: Build Wheels
uses: pypa/cibuildwheel@v2.16.5
uses: pypa/cibuildwheel@v2.18.0
with:
package-dir: .
output-dir: wheelhouse
Expand All @@ -38,7 +39,7 @@ jobs:
- name: Store Wheel Artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
name: dist-wheels-${{ matrix.os }}
path: wheelhouse/*.whl

build_sdist:
Expand All @@ -47,6 +48,8 @@ jobs:
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:
jobs:
get_dataset:
env:
cache-name: dataset
cache-name: dataset-cache

name: Get / Update Example Dataset
runs-on: ubuntu-latest
Expand All @@ -31,7 +31,6 @@ jobs:

- name: Restore Example Dataset Cache
uses: actions/cache@v4
id: dataset-cache
with:
path: ./data/cache/
key: huggingface-${{ env.cache-name }}
Expand Down
72 changes: 0 additions & 72 deletions .github/workflows/pypi_publish.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
pull-requests: write # for release-drafter/release-drafter to add label to PR
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5.22.0
- uses: release-drafter/release-drafter@v6
# Specify config name to use, relative to .github/. Default: release-drafter.yml
with:
config-name: release-drafter.yml
config-name: release-drafter-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121 changes: 121 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Build Wheels and upload to PyPI

on:
pull_request:
branches: ["releases/**"]
types: [labeled, opened, synchronize, reopened]
release:
types: [published]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
test:
name: Test
permissions:
contents: read
secrets: inherit
uses: ./.github/workflows/test.yml

build:
name: Build distribution 📦
uses: ./.github/workflows/build.yml
secrets: inherit

publish-to-testpypi:
# Test PyPI publish, requires wheels and source dist to pass
name: >-
Publish Python 🐍 distribution 📦 to TestPyPI
needs: [test, build]
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/ark-analysis

permissions:
id-token: write # Necessary for trusted publishing

steps:
- name: Download Built Distributions 📦
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist

- name: Publish distributions 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
with:
repository-url: https://test.pypi.org/legacy/


publish-to-pypi:
# PyPI publish requires test, wheels, source dist, and testpypi to pass
name: >-
Publish Python 🐍 Distributions 📦 to PyPI
needs: [test, build, publish-to-testpypi]
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/ark-analysis

permissions:
id-token: write

# Publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download Built Distributions 📦
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist/

- name: Publish Distributions 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9


github-release-upload-dists:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to the GitHub Release
needs: [test, build, publish-to-testpypi, publish-to-pypi]
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download Built Distributions 📦
uses: actions/download-artifact@v4
with:
pattern: dist-*
merge-multiple: true
path: dist/

- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
os: [ubuntu-latest, macos-13, windows-latest]
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
cache-name: dataset-cache

steps:
- name: Checkout ${{ github.repository }}
Expand All @@ -31,11 +32,9 @@ jobs:

- name: Download Example Dataset Cache
uses: actions/cache/restore@v4
env:
cache-name: dataset
with:
path: ./data/cache/
key: huggingface-${{env.cache-name}}
key: huggingface-${{ env.cache-name }}
enableCrossOsArchive: true
fail-on-cache-miss: true

Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ requires = [
"setuptools",
"Cython>=3",
"numpy>=1.20,<1.24",
"setuptools_scm[toml]>=6",
"setuptools_scm>=8",
"build",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -44,6 +45,7 @@ dependencies = [
"xmltodict>=0.13.0,<1",
"zstandard>=0.19.0,<1",
"zarr",
"python-dateutil>=2.9.0",
"ark-analysis[colors]",
]
name = "ark-analysis"
Expand All @@ -65,6 +67,11 @@ dynamic = ["version"]
urls = { repository = "https://github.com/angelolab/ark-analysis" }

[project.optional-dependencies]
dev = [
"ark-analysis[test]",
"build>=1.2.1",
"setuptools_scm[rich]>=8",
]
colors = [
"palettable",
"cmasher",
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from Cython.Build import cythonize
from Cython.Compiler.Options import get_directive_defaults
from setuptools import Extension, setup
import setuptools_scm

_compiler_directives = get_directive_defaults()

Expand Down
Loading
Loading