-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- assign reviewers (currently only kaitj and tkkuehn, can add more) - bump_version for semantic versioning - release to publish to pypi - test for linting and unit testing
- Loading branch information
Showing
6 changed files
with
282 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# Set to true to add reviewers to pull requests | ||
addReviewers: true | ||
|
||
# Set to true to add assignees to pull requests | ||
addAssignees: author | ||
# A list of reviewers to be added to pull requests (GitHub user name) | ||
reviewers: | ||
- kaitj | ||
- tkkuehn | ||
# A number of reviewers added to the pull request | ||
# Set 0 to add all the reviewers (default: 0) | ||
numberOfReviewers: 0 | ||
|
||
# A list of assignees, overrides reviewers if set | ||
# assignees: | ||
# - assigneeA | ||
|
||
# A number of assignees to add to the pull request | ||
# Set to 0 to add all of the assignees. | ||
# Uses numberOfReviewers if unset. | ||
# numberOfAssignees: 2 | ||
|
||
# A list of keywords to be skipped the process that add reviewers if pull requests include it | ||
# skipKeywords: | ||
# - wip |
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,28 @@ | ||
--- | ||
name-template: $RESOLVED_VERSION | ||
tag-template: v$RESOLVED_VERSION | ||
filter-by-commitish: true | ||
template: | | ||
## Changes | ||
$CHANGES | ||
categories: | ||
- title: 🚀 Features | ||
labels: [breaking, enhancement] | ||
- title: 🐛 Bug Fixes | ||
labels: [bug] | ||
- title: 🧰 Maintenance | ||
labels: [maintenance, test] | ||
- title: 📝 Documentation | ||
labels: [documentation] | ||
exclude-labels: [skip_changelog] | ||
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: | ||
# - 'breaking' | ||
minor: | ||
labels: [breaking, enhancement] | ||
patch: | ||
labels: [maintenance, bug, test, documentation] | ||
default: patch |
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,14 @@ | ||
--- | ||
name: Assign reviewer | ||
on: | ||
pull_request_target: | ||
types: [opened, ready_for_review] | ||
jobs: | ||
assign: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.assignee == null | ||
steps: | ||
- name: Assign reviewer | ||
uses: kentaro-m/auto-assign-action@v1.2.4 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
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,66 @@ | ||
--- | ||
name: Bump version | ||
on: | ||
pull_request_target: | ||
types: [closed] | ||
jobs: | ||
build: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout master branch | ||
uses: actions/checkout@master | ||
with: | ||
ref: ${{ github.event.pull_request.base.ref }} | ||
- name: Update changelog | ||
uses: release-drafter/release-drafter@v5 | ||
id: release-drafter | ||
with: | ||
commitish: ${{ github.event.pull_request.base.ref }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BP_PAT_TOKEN }} | ||
- name: Get previous release version | ||
run: | | ||
echo "PREV_VER=$(cat pyproject.toml | grep -o -E '(version\s=\s)([[:punct:]])([0-9]+\.[0-9]+\.[0-9]+.+)([[:punct:]])' | cut -d ' ' -f 3 | tr -d '"')" >> $GITHUB_ENV | ||
- name: Get previous bump version | ||
env: | ||
PREV_VER: ${{ env.PREV_VER }} | ||
run: | | ||
if [[ "$PREV_VER" != *"-pre."* ]]; then | ||
echo "OLD_BUMP=0" >> $GITHUB_ENV | ||
else | ||
echo "OLD_BUMP=$(echo $PREV_VER | cut -d '.' -f 4)" >> $GITHUB_ENV | ||
fi | ||
- name: Bump version | ||
env: | ||
BUMP_VER: ${{ env.OLD_BUMP }} | ||
run: | | ||
echo "NEW_BUMP=$(($BUMP_VER + 1))" >> $GITHUB_ENV | ||
- name: Set new release version | ||
env: | ||
RD_RELEASE: ${{ steps.release-drafter.outputs.name }} | ||
run: | | ||
if [ ! -z "$RD_RELEASE" ]; then | ||
echo "NEW_RELEASE=$RD_RELEASE" >> $GITHUB_ENV | ||
else | ||
echo "NEW_RELEASE=0.1.0" >> $GITHUB_ENV | ||
fi | ||
- name: Update version in pyproject.toml | ||
uses: jacobtomlinson/gha-find-replace@master | ||
with: | ||
include: pyproject.toml | ||
find: version = "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))" | ||
replace: version = "${{ env.NEW_RELEASE }}-pre.${{ env.NEW_BUMP }}" | ||
- name: Commit updates | ||
env: | ||
SNAKEBIDS_VERSION: ${{ env.NEW_RELEASE }}-pre.${{ env.NEW_BUMP }} | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git diff-index --quiet HEAD || git commit -m "Bump version to $SNAKEBIDS_VERSION" -a | ||
- name: Push changes | ||
uses: CasperWA/push-protected@v2 | ||
with: | ||
branch: ${{ github.event.pull_request.base.ref }} | ||
token: ${{ secrets.BP_PAT_TOKEN }} | ||
unprotect_reviews: true |
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,66 @@ | ||
--- | ||
name: Release package | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
comments: | ||
description: Comments | ||
required: false | ||
jobs: | ||
release_changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Print author | ||
run: | | ||
echo "Author: ${{ github.triggering_actor }}" | ||
echo "Comments: ${{ github.event.inputs.comments }}" | ||
- name: Extract branch name | ||
shell: bash | ||
id: extract_branch | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
- uses: actions/checkout@master | ||
with: | ||
ref: ${{ steps.extract_branch.outputs.branch }} | ||
- name: Draft change log | ||
uses: release-drafter/release-drafter@v5 | ||
id: release-drafter | ||
with: | ||
commitish: ${{ steps.extract_branch.outputs.branch }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set new release version | ||
env: | ||
RD_RELEASE: ${{ steps.release-drafter.outputs.name }} | ||
run: | | ||
if [ ! -z "$RD_RELEASE" ]; then | ||
echo "NEW_RELEASE=$RD_RELEASE" >> $GITHUB_ENV | ||
else | ||
echo "NEW_RELEASE=0.1.0" >> $GITHUB_ENV | ||
fi | ||
- name: Update version in pyproject.toml | ||
uses: jacobtomlinson/gha-find-replace@master | ||
with: | ||
include: pyproject.toml | ||
find: version = "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))" | ||
replace: version = "${{ env.NEW_RELEASE }}" | ||
- name: Commit updates | ||
env: | ||
LATEST_VERSION: ${{ env.NEW_RELEASE }} | ||
run: | | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git diff-index --quiet HEAD || git commit -m "Bump version to $LATEST_VERSION" -a | ||
- name: Push changes | ||
uses: CasperWA/push-protected@v2 | ||
with: | ||
token: ${{ secrets.BP_PAT_TOKEN }} | ||
unprotect_reviews: true | ||
- name: Publish change log | ||
uses: release-drafter/release-drafter@v5 | ||
with: | ||
commitish: ${{ steps.extract_branch_outputs.branch }} | ||
publish: true | ||
name: ${{ env.NEW_RELEASE }} | ||
tag: v${{ env.NEW_RELEASE }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BP_PAT_TOKEN }} |
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,82 @@ | ||
--- | ||
name: Lint and test workflow | ||
on: | ||
push: | ||
branches: ['*', '!push-action/*'] | ||
pull_request: | ||
branches: ['*', '!push-action/*'] | ||
jobs: | ||
quality: | ||
name: Lint code | ||
if: github.event.pull_request.merged == false | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@master | ||
- name: Setup Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-3.10 | ||
restore-keys: ${{ runner.os }}-pip-3.10 | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-3.10 | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root --with dev | ||
- name: yamlfix | ||
run: poetry run poe yamlfix-check | ||
- name: isort | ||
run: poetry run poe isort-check | ||
- name: black | ||
run: poetry run poe black-check | ||
- name: ruff | ||
run: poetry run poe ruff-check | ||
test: | ||
runs-on: ubuntu-latest | ||
needs: [quality] | ||
strategy: | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10'] | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@master | ||
- name: Select Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ matrix.python-version }} | ||
restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }} | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version | ||
}} | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root --with dev | ||
# Example of test | ||
# - name: Test minimum inputs | ||
# run: poetry run poe test_base |