Skip to content

Commit

Permalink
add ci pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
berislavlopac committed Oct 5, 2022
1 parent 54bd8cc commit 9248565
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .semaphore/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: v1.0
name: Publish release
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004
global_job_config:
prologue:
commands:
- sem-version python 3.8
- checkout
- python -m pip install -U pip poetry
blocks:
- name: Create release
run:
when: "branch = 'main'"
task:
secrets:
- name: semantic-release-credentials
jobs:
- name: Collect package details and create GitHub release
commands:
- RELEASE_VERSION=$(python -m poetry version -s)
- 'RELEASE_NOTES_FILE="release-notes/${RELEASE_VERSION}.md"'
- 'if [ ! -f "$RELEASE_NOTES_FILE" ]; then echo "The release notes file \"${RELEASE_NOTES_FILE}\" does not exist."; exit 1; fi'
- 'if [[ $RELEASE_VERSION =~ \.[0-9]+(a|b|rc)[0-9] ]]; then PRERELEASE="--prerelease"; fi'
- gh release create $RELEASE_VERSION --notes-file $RELEASE_NOTES_FILE $PRERELEASE
70 changes: 70 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: v1.0
name: Python checks and tests
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004
global_job_config:
prologue:
commands:
- checkout
blocks:
- name: Code checks
dependencies: []
task:
prologue:
commands:
- sem-version python 3.8
- python -m pip install -U pip poetry tox tox-poetry
jobs:
- name: checks
commands:
- python -m tox -e checks
- name: Unit tests
dependencies:
- Code checks
task:
prologue:
commands:
- sem-version python $PY_VERSION
- python -m pip install -U pip poetry tox tox-poetry
jobs:
- name: tests
matrix:
- env_var: PY_VERSION
values:
- '3.8'
- '3.9'
- '3.10'
commands:
- 'PY_ENV=py"${PY_VERSION//.}"'
- python -m tox -e $PY_ENV
epilogue:
on_pass:
commands:
- 'test-results publish "test-reports/$PY_ENV-junit.xml"'
- name: Publish release
dependencies: ["Unit tests"]
run:
when: "tag =~ '^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?$'"
task:
secrets:
- name: pypi-credentials
prologue:
commands:
- sem-version python 3.8
- python -m pip install -U pip poetry
jobs:
- name: Build and upload Python package
commands:
- poetry build -f wheel
- poetry publish -u b11c -p $PYPI_PASSWORD
after_pipeline:
task:
jobs:
- name: Publish Test Results
commands:
- test-results gen-pipeline-report
promotions:
- name: Create new release
pipeline_file: create-release.yml

0 comments on commit 9248565

Please sign in to comment.