-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from AllenInstitute/feature/DT-6858-make-packa…
…ge-public Adding License, docs and placeholder workflows to make package public
- Loading branch information
Showing
7 changed files
with
276 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,139 @@ | ||
name: Create Release | ||
name: Publish to PyPI | ||
|
||
on: | ||
# push: | ||
# tags: | ||
# - 'v*' | ||
|
||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Target Tag for Release' | ||
type: string | ||
part: | ||
description: "Semver part to bump (major, minor, patch)" | ||
type: choice | ||
required: true | ||
force: | ||
description: 'Force Release?' | ||
default: "patch" | ||
options: ["major", "minor", "patch"] | ||
dry-run: | ||
description: "Dry run" | ||
type: boolean | ||
required: false | ||
default: false | ||
required: true | ||
default: true | ||
python-version: | ||
description: "Python version used to build the distribution" | ||
type: choice | ||
required: true | ||
default: "3.11" | ||
options: ["3.9", "3.10", "3.11", "3.12"] | ||
|
||
jobs: | ||
create-release: | ||
bump: | ||
name: Bump version | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
outputs: | ||
VERSION: ${{ steps.get-version-and-commit-sha.outputs.VERSION }} | ||
SHORT_VERSION: ${{ steps.get-version-and-commit-sha.outputs.SHORT_VERSION }} | ||
MAJOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MAJOR_VERSION }} | ||
MINOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MINOR_VERSION }} | ||
PATCH_VERSION: ${{ steps.get-version-and-commit-sha.outputs.PATCH_VERSION }} | ||
COMMIT_SHA: ${{ steps.get-version-and-commit-sha.outputs.COMMIT_SHA }} | ||
steps: | ||
- name: Checkout code | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python ${{ github.event.inputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ github.event.inputs.python-version }} | ||
cache: 'pip' | ||
- name: Set up AllenInstitute Repo Authorization | ||
uses: ./.github/actions/configure-org-repo-authorization | ||
with: | ||
token: ${{ secrets.AI_PACKAGES_TOKEN }} | ||
- name: Get tags | ||
run: git fetch --tags origin | ||
- name: Configure git for github-actions[bot] | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
- name: Run Install | ||
run: | | ||
make install-release | ||
shell: bash | ||
- name: Bump version with bumpversion | ||
run: | | ||
source .venv/bin/activate | ||
bump-my-version bump ${{ github.event.inputs.part }} | ||
- name: Commit and push with tags | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
run: | | ||
git push --follow-tags | ||
- name: Get version and commit SHA | ||
id: get-version-and-commit-sha | ||
run: | | ||
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | ||
# remove the leading v from tag | ||
version="${latest_tag:1}" | ||
echo "VERSION=$version" >> $GITHUB_OUTPUT | ||
major_version="$(cut -d '.' -f 1 <<< $version)" | ||
echo "MAJOR_VERSION=$major_version" >> $GITHUB_OUTPUT | ||
minor_version="$(cut -d '.' -f 2 <<< $version)" | ||
echo "MINOR_VERSION=$minor_version" >> $GITHUB_OUTPUT | ||
patch_version="$(cut -d '.' -f 3 <<< $version)" | ||
echo "PATCH_VERSION=$patch_version" >> $GITHUB_OUTPUT | ||
short_version="$major_version.$minor_version" | ||
echo "SHORT_VERSION=$short_version" >> $GITHUB_OUTPUT | ||
commit_sha=$(git rev-parse $latest_tag) | ||
echo "COMMIT_SHA=$commit_sha" >> $GITHUB_OUTPUT | ||
- name: Show version | ||
run: | | ||
echo VERSION: ${{ steps.get-version-and-commit-sha.outputs.VERSION }} | ||
echo SHORT_VERSION: ${{ steps.get-version-and-commit-sha.outputs.SHORT_VERSION }} | ||
echo MAJOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MAJOR_VERSION }} | ||
echo MINOR_VERSION: ${{ steps.get-version-and-commit-sha.outputs.MINOR_VERSION }} | ||
echo PATCH_VERSION: ${{ steps.get-version-and-commit-sha.outputs.PATCH_VERSION }} | ||
echo COMMIT_SHA: ${{ steps.get-version-and-commit-sha.outputs.COMMIT_SHA }} | ||
build: | ||
name: Build distribution | ||
runs-on: ubuntu-latest | ||
needs: bump | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.tag || github.ref }} | ||
- name: Create Release with Changelog | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
ref: ${{ needs.bump.outputs.COMMIT_SHA }} | ||
- name: Set up Python ${{ github.event.inputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ github.event.inputs.python-version }} | ||
cache: 'pip' | ||
- name: Set up AllenInstitute Repo Authorization | ||
uses: ./.github/actions/configure-org-repo-authorization | ||
with: | ||
token: ${{ secrets.AI_PACKAGES_TOKEN }} | ||
- name: Run Release | ||
run: | | ||
make dist | ||
shell: bash | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-pypi: | ||
name: Publish to PyPI | ||
needs: build | ||
if: ${{ github.event.inputs.dry-run == 'false' }} | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/aibs-informatics-cdk-lib | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
tag_name: ${{ github.event.inputs.tag || github.ref_name }} | ||
name: Release ${{ github.event.inputs.tag || github.ref_name }} | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Contributing to `aibs-informatics-cdk-lib` | ||
|
||
Contributions are welcome and appreciated! | ||
|
||
## Types of Contributions | ||
|
||
### Reporting Bugs | ||
|
||
Report bugs to our [issues page](https://github.com/aibs-informatics-cdk-lib/issues). | ||
|
||
If you are reporting a bug, please include: | ||
|
||
- Your operating system name and version. | ||
- Any details about your local setup that might be helpful in troubleshooting. | ||
- Detailed steps to reproduce the bug, in the form of a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). | ||
|
||
### Making Changes | ||
|
||
Look through the GitHub issues for bugs, features, and other requests. Most issues will have a label that can help you identify the type of issue. | ||
|
||
### Submitting Feedback | ||
|
||
The best way to send feedback is to [create an issue](https://github.com/aibs-informatics-cdk-lib/issues/new) on GitHub. | ||
|
||
If you are proposing a feature: | ||
|
||
- Explain in detail how it would work. | ||
- Keep the scope as narrow as possible, to make it easier to implement. | ||
- Remember that while contributions are welcome, developer/maintainer time is limited. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Allen Institute Software License – This software license is the 2-clause BSD | ||
license plus a third clause that prohibits redistribution and use for | ||
commercial purposes without further permission. | ||
|
||
Copyright © 2024. Allen Institute. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Redistributions and use for commercial purposes are not permitted without | ||
the Allen Institute’s written permission. For purposes of this license, | ||
commercial purposes are the incorporation of the Allen Institute's software | ||
into anything for which you will charge fees or other compensation or use of | ||
the software to perform a commercial service for a third party. Contact | ||
[email protected] for commercial licensing opportunities. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# AIBS Informatics CDK Library | ||
|
||
[![Build Status](https://github.com/AllenInstitute/aibs-informatics-cdk-lib/actions/workflows/build.yml/badge.svg)](https://github.com/AllenInstitute/aibs-informatics-cdk-lib/actions/workflows/build.yml) | ||
|
||
--- | ||
|
||
## Overview | ||
|
||
The AIBS Informatics CDK Library is a collection of AWS Cloud Development Kit (CDK) constructs and utilities designed to facilitate the deployment and management of cloud infrastructure for the Allen Institute for Brain Science. This library includes constructs for managing AWS Batch environments, Elastic File System (EFS) configurations, CloudWatch dashboards, and more. It aims to provide reusable and configurable components to streamline the development and deployment of cloud-based applications and services. | ||
|
||
### Modules | ||
|
||
- **Batch**: Constructs for setting up and managing AWS Batch environments, including job queues, compute environments, and monitoring. | ||
- **EFS**: Utilities and constructs for configuring and managing Elastic File System (EFS) resources. | ||
- **CloudWatch**: Tools for creating and managing CloudWatch dashboards and alarms. | ||
- **Service Compute**: Constructs for defining compute resources, including Lambda functions and Batch compute environments. | ||
- **State Machine Fragments**: Reusable fragments for AWS Step Functions, including batch job submission and data synchronization. | ||
- **Assets**: Definitions and utilities for managing code assets, including Lambda functions and Docker images. | ||
- **Core**: Base constructs and utilities used across the library, including environment configurations and common IAM policies. | ||
|
||
## Contributing | ||
|
||
Any and all PRs are welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information. | ||
|
||
## Licensing | ||
|
||
This software is licensed under the Allen Institute Software License, which is the 2-clause BSD license plus a third clause that prohibits redistribution and use for commercial purposes without further permission. For more information, please visit [Allen Institute Terms of Use](https://alleninstitute.org/terms-of-use/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,23 @@ dynamic = [ | |
"version", | ||
] | ||
dependencies = [ | ||
"aibs-informatics-aws-utils @ git+ssh://[email protected]/AllenInstitute/aibs-informatics-aws-utils.git@main", | ||
"aibs-informatics-core @ git+ssh://[email protected]/AllenInstitute/aibs-informatics-core.git@main", | ||
"aibs-informatics-aws-utils", | ||
"aibs-informatics-core", | ||
"aws-cdk-lib~=2.96", | ||
"constructs~=10.0", | ||
"pydantic~=2.0", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"aibs-informatics-test-resources", | ||
"boto3-stubs[s3,batch]", | ||
"aibs-informatics-test-resources @ git+ssh://[email protected]/AllenInstitute/aibs-informatics-test-resources.git@main", | ||
] | ||
|
||
release = [ | ||
"build", | ||
"bump-my-version", | ||
"wheel", | ||
] | ||
|
||
[tool.setuptools.dynamic] | ||
|
@@ -40,6 +46,14 @@ version = {attr = "aibs_informatics_cdk_lib._version.__version__"} | |
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
|
||
|
||
[project.urls] | ||
Documentation = "https://.github.io/aibs-informatics-cdk-lib/" | ||
Homepage = "https://github.com/AllenInstitute/aibs-informatics-cdk-lib/" | ||
Issues = "https://github.com/AllenInstitute/aibs-informatics-cdk-lib/issues" | ||
Repository = "https://github.com/AllenInstitute/aibs-informatics-cdk-lib/" | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
## Pyright Configurations | ||
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md | ||
|
@@ -210,3 +224,29 @@ profile = "black" | |
src_paths = ["src", "test"] | ||
skip = [".venv", "build", "cdk.out"] | ||
|
||
# ----------------------------------------------------------------------------- | ||
## bumpversion Configurations | ||
# https://callowayproject.github.io/bump-my-version/ | ||
# ----------------------------------------------------------------------------- | ||
|
||
[tool.bumpversion] | ||
allow_dirty = false | ||
commit = true | ||
commit_args = "" | ||
current_version = "0.0.1" | ||
ignore_missing_version = false | ||
message = "Bump version: {current_version} → {new_version}" | ||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" | ||
regex = false | ||
replace = "{new_version}" | ||
search = "{current_version}" | ||
serialize = ["{major}.{minor}.{patch}"] | ||
sign_tags = false | ||
tag = true | ||
tag_message = "Bump version: {current_version} → {new_version}" | ||
tag_name = "v{new_version}" | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "src/aibs_informatics_cdk_lib/_version.py" | ||
search = "__version__ = \"{current_version}\"" | ||
replace = "__version__ = \"{new_version}\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters