-
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.
feat: add auto release pipeline (#4)
- Loading branch information
Showing
9 changed files
with
247 additions
and
35 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
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,15 @@ | ||
name: Check branch commit | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' # matches every branch ... | ||
- '!main' # ... that is not main | ||
|
||
jobs: | ||
isort: | ||
uses: ./.github/workflows/isort.yml | ||
black: | ||
uses: ./.github/workflows/black.yml | ||
build: | ||
uses: ./.github/workflows/build.yml |
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,42 @@ | ||
name: Test BSB Arbor adapter | ||
|
||
on: [ workflow_call ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11" ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install apt dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install openmpi-bin libopenmpi-dev | ||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies & self | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[test] | ||
- name: Run tests & coverage | ||
run: | | ||
coverage run -p -m unittest discover -v -s ./tests | ||
mpiexec -n 2 coverage run -p -m unittest discover -v -s ./tests | ||
bash <(curl -s https://codecov.io/bash) |
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 |
---|---|---|
@@ -1,39 +1,155 @@ | ||
name: Test BSB Arbor adapter | ||
name: Build bsb-arbor and deploy | ||
|
||
on: [ push, pull_request ] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
isort: | ||
uses: ./.github/workflows/isort.yml | ||
black: | ||
uses: ./.github/workflows/black.yml | ||
build: | ||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | ||
uses: ./.github/workflows/build.yml | ||
|
||
tag_release: | ||
needs: [isort, black, build] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ "3.9", "3.10", "3.11" ] | ||
outputs: | ||
tag: ${{ steps.semver.outputs.next }} | ||
old_tag: ${{ steps.semver.outputs.current }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
- name: Create Github token | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install apt dependencies | ||
app-id: ${{ vars.DBBS_APP_ID }} | ||
private-key: ${{ secrets.DBBS_APP_PRIVATE_KEY }} | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Get Next Version | ||
id: semver | ||
uses: ietf-tools/semver-action@v1 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
branch: main | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Bump version in Python project | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install openmpi-bin libopenmpi-dev | ||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- name: Install dependencies & self | ||
pip install --upgrade pip bump-my-version | ||
oldv="${{ steps.semver.outputs.current }}" | ||
newv="${{steps.semver.outputs.next}}" | ||
# Bump the version, dropping the leading `v` with `${x:1}` | ||
bump-my-version replace --current-version=${oldv:1} --new-version=${newv:1} pyproject.toml | ||
- name: Commit & Push version change | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: main | ||
commit_message: 'docs: bump version: ${{ steps.semver.outputs.current }} → ${{ steps.semver.outputs.next }} [skip ci]' | ||
|
||
- name: Create tag | ||
uses: rickstaa/action-create-tag@v1 | ||
with: | ||
tag: ${{ steps.semver.outputs.next }} | ||
github_token: ${{ steps.app-token.outputs.token }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: tag_release | ||
|
||
steps: | ||
- name: Create Github token | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.DBBS_APP_ID }} | ||
private-key: ${{ secrets.DBBS_APP_PRIVATE_KEY }} | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Pull commit of version change | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[test] | ||
- name: Run tests & coverage | ||
git pull origin main | ||
- name: Update CHANGELOG | ||
id: changelog | ||
uses: requarks/changelog-action@v1 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
fromTag: ${{ needs.tag_release.outputs.tag }} | ||
toTag: ${{ needs.tag_release.outputs.old_tag }} | ||
|
||
- name: Create Release | ||
uses: ncipollo/[email protected] | ||
with: | ||
allowUpdates: true | ||
draft: false | ||
makeLatest: true | ||
tag: ${{ needs.tag_release.outputs.tag }} | ||
name: ${{ needs.tag_release.outputs.tag }} | ||
body: ${{ steps.changelog.outputs.changes }} | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Commit CHANGELOG.md | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: main | ||
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' | ||
file_pattern: CHANGELOG.md | ||
|
||
pypi-publish: | ||
runs-on: ubuntu-latest | ||
needs: release | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/bsb-arbor | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
steps: | ||
- name: Create Github token | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.DBBS_APP_ID }} | ||
private-key: ${{ secrets.DBBS_APP_PRIVATE_KEY }} | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Pull commits of version bump | ||
run: | | ||
git pull origin main | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Install dependencies and build dist | ||
run: | | ||
coverage run -p -m unittest discover -v -s ./tests | ||
mpiexec -n 2 coverage run -p -m unittest discover -v -s ./tests | ||
bash <(curl -s https://codecov.io/bash) | ||
python -m pip install --upgrade pip | ||
pip install build | ||
python -m build | ||
- name: Publish package distributions 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,14 @@ | ||
name: Validate Pull Request | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
|
||
jobs: | ||
validate-pr-title: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: PR Conventional Commit Validation | ||
uses: ytanikin/[email protected] | ||
with: | ||
task_types: '["feat","fix","docs","test","ci","refactor","perf","revert"]' |
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,8 @@ | ||
## [v4.0.0] | ||
### What's Changed | ||
* Add CI and beta deps by @Helveg in https://github.com/dbbs-lab/bsb-arbor/pull/1 | ||
|
||
### New Contributors | ||
* @Helveg made their first contribution in https://github.com/dbbs-lab/bsb-arbor/pull/1 | ||
|
||
**Full Changelog**: https://github.com/dbbs-lab/bsb-arbor/commits/v4.0.0 |
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 +1,9 @@ | ||
[![Build Status](https://github.com/dbbs-lab/bsb-arbor/actions/workflows/main.yml/badge.svg)](https://github.com/dbbs-lab/bsb-arbor/actions/workflows/main.yml) | ||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) | ||
|
||
# bsb-arbor | ||
|
||
bsb-nest is a pluggin of [BSB](https://github.com/dbbs-lab/bsb) (see also | ||
[bsb-core](https://github.com/dbbs-lab/bsb-core)). | ||
It contains the interfaces and tools to simulate BSB circuit with the | ||
[Arbor simulator](https://arbor-sim.org/). |