Skip to content
Open
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
73 changes: 0 additions & 73 deletions .github/workflows/build-and-publish.yml

This file was deleted.

33 changes: 18 additions & 15 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
name: Build and Test (branches)
name: Build and Test
on:
push:
branches:
- 'feature/*'
- 'fix/*'
branches: [master]
pull_request:
branches: [master]
workflow_call:

env:
POETRY_VERSION: 1.8.2
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Lint code
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --show-source --statistics
mypy semversioner tests
- name: Build and test
run: |
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Install Poetry ${{ env.POETRY_VERSION }}
uses: abatilo/[email protected]
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Lint
run: poetry run poe lint
- name: Test
run: poetry run poe test --junitxml=junit/test-results-${{ matrix.python-version }}.xml
- name: Build
run: poetry build
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish
on:
push:
branches: [master]

jobs:
build:
uses: ./.github/workflows/build-and-test.yml
publish:
needs: build
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/semversioner
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Poetry 1.8.2
uses: abatilo/[email protected]
with:
poetry-version: '1.8.2'

- name: Install dependencies
shell: bash
run: poetry install

- name: Build Distributable
shell: bash
run: poetry build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on Github Actions as I normally use other CI/CD tools, but I'd like to find a way that we build only once, and deploy exactly the same artifact we run the tests against. From what I understand from this workflow is that we are building it again, pulling dependencies, etc. The poetry.lock file helps reducing the risk to introducting non tested behaviour, but overall I'd like to have a CI/CD workflow that enforces:

After merging to master:

  • We run tests
  • We package only once
  • We publish the package we run the tests against

Does it make sense? I'll read a bit more about how to achieve that in actions.


- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to use poetry publish here instead of relying on the github action?

with:
packages-dir: dist
skip-existing: true
verbose: true
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

11 changes: 0 additions & 11 deletions mypy.ini

This file was deleted.

Loading