-
Notifications
You must be signed in to change notification settings - Fork 11
Modernize gh actions and pyproject #97
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
64594fe
1fa4e79
bf04f59
bf09762
484b02d
a2728fb
777c771
d7f5fce
15c9ec1
eced5ac
ea82539
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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Please see the documentation for all configuration options: | ||
| # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
|
||
| # This configures updates via dependabot only for github actions. | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: "monthly" | ||
|
dalito marked this conversation as resolved.
|
||
| cooldown: | ||
| default-days: 5 | ||
| groups: | ||
| github-actions: | ||
| patterns: | ||
| - "*" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Python package | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| PIP_DISABLE_PIP_VERSION_CHECK: "1" | ||
| PIP_PROGRESS_BAR: "off" | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| tests: | ||
| name: Python ${{ matrix.python-version }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: | ||
| - '3.9' | ||
| - '3.10' | ||
| - '3.11' | ||
| - '3.12' | ||
| - '3.13' | ||
| - '3.14' | ||
| steps: | ||
| - uses: actions/checkout@v6.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6.1.0 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install package | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install .[dev] | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| python -m pytest | ||
|
|
||
| - name: Build Sphinx documentation | ||
| run: | | ||
| sphinx-build -b html --nitpicky --fail-on-warning --keep-going docs docs/_build/html |
|
Member
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. Are the different jobs for building and publishing necessary? Running these steps in one job would remove the need for upload-artifact and download-artifact steps.
Author
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. The main reason is security / isolation. The OpenID connect token is only available in pubishing this way. This is now best practice and also suggested in Python packaging guides.
Member
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. Ok, to me it feels a bit insecure to also download the distribution to publish from another job, but that is suggested also here https://docs.pypi.org/trusted-publishers/security-model/:
For a reference see also this: pypa/gh-action-pypi-publish#324 (comment) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Publish Python Package | ||
| # Publishes tO PyPI for releases created in GitHub UI | ||
| # Note: For draft status, publishing is not triggered. | ||
| # Builds a packages for new tags "v1.2.3" or "v1.2.3.something" on master | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| # GitHub glob matching is limited [1]. So we can't define a pattern matching | ||
| # pep 440 version definition [N!]N(.N)*[{a|b|rc}N][.postN][.devN] | ||
| - 'v[0-9]+.[0-9]+.[0-9]+.?*' | ||
| release: | ||
|
Member
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. Do we want to have this workflow trigger on releases too? Previously there was only the trigger on tags.
Author
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 triggered on both. Typically I publish to test-pypi on the tag and to pypi by creating a gh release. Note, that below is still the filter to only publish to PyPI for a GitHub-release. Tell me what you prefer (or change it - committing to the PR is allowed for maintainers). |
||
| types: [published] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build Python 🐍 distributions 📦 for publishing | ||
| # Don't try to publish from forks | ||
| if: github.repository == 'NatLibFi/Skosify' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6.1.0 | ||
| with: | ||
| python-version: 3.13 | ||
|
|
||
| - name: Install hatch | ||
| run: pipx install hatch | ||
|
|
||
| - name: Build source and wheel archives | ||
| run: hatch build | ||
|
|
||
| - name: Store built distribution | ||
| uses: actions/upload-artifact@v6.0.0 | ||
| with: | ||
| name: distribution-files | ||
| path: dist/ | ||
|
|
||
| pypi-publish: | ||
| name: Build and publish Python 🐍 package 📦 to PyPI and TestPyPI | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi-release | ||
| url: https://pypi.org/p/skosify | ||
| permissions: | ||
| id-token: write # this permission is mandatory for trusted publishing | ||
| steps: | ||
| - name: Download built distribution | ||
| uses: actions/download-artifact@v7.0.0 | ||
| with: | ||
| name: distribution-files | ||
| path: dist | ||
|
|
||
| - name: Publish package 📦 to PyPI | ||
| if: github.event_name == 'release' | ||
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | ||
| with: | ||
| verbose: true | ||
|
|
||
| # [1] https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,3 +53,5 @@ coverage.xml | |
| # Sphinx documentation | ||
| docs/_build/ | ||
|
|
||
| # Autogenerated version file | ||
| skosify/_version.py | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| .PHONY: test docs build | ||
|
|
||
| test: | ||
| python setup.py test | ||
| pytest | ||
|
|
||
| doc: | ||
| rm -rf docs/_build | ||
| $(MAKE) -C docs html | ||
|
|
||
| build: | ||
| python setup.py bdist_wheel | ||
| hatch build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,10 @@ Publications | |
| - Osma Suominen and Christian Mader: Assessing and Improving the | ||
| Quality of SKOS Vocabularies. Journal on Data Semantics, vol. 3, no. | ||
| 1, pp. 47-73, June, 2014 | ||
| (`PDF <https://seco.cs.aalto.fi/publications/2014/suominen-mader-skosquality.pdf>`_) | ||
| (`PDF <https://seco.cs.aalto.fi/publications/2014/suominen-mader-skosquality.pdf>`__) | ||
|
Author
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. Avoids sphinx |
||
|
|
||
| - Osma Suominen and Eero Hyvönen: Improving the Quality of SKOS | ||
| Vocabularies with Skosify. Proceedings of the 18th International | ||
| Conference on Knowledge Engineering and Knowledge Management (EKAW | ||
| 2012), Springer-Verlag, Galway, Ireland, October, 2012 | ||
| (`PDF <https://seco.cs.aalto.fi/publications/2012/suominen-hyvonen-skosify-2012.pdf>`_) | ||
| (`PDF <https://seco.cs.aalto.fi/publications/2012/suominen-hyvonen-skosify-2012.pdf>`__) | ||
Uh oh!
There was an error while loading. Please reload this page.