-
Notifications
You must be signed in to change notification settings - Fork 7
poetry Build System
#49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
723f9fd
b15fea5
5ea5c22
7687db1
9f83c24
96cd77c
ac1b99a
c298229
2644c0f
94ac3c9
580b218
53c4442
06476b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| 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: | ||
|
|
||
| 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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is possible to use |
||
| with: | ||
| packages-dir: dist | ||
| skip-existing: true | ||
| verbose: true | ||
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.