-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from simonprovost/feature/pypi-publishment
feat(ci): add publish pypi job
- Loading branch information
Showing
12 changed files
with
357 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ on: | |
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'docs/**' | ||
permissions: | ||
contents: write | ||
jobs: | ||
|
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,75 @@ | ||
name: publish-pypi | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check_build_trigger: | ||
name: Check build trigger | ||
runs-on: ubuntu-latest | ||
outputs: | ||
build: ${{ steps.check_build_trigger.outputs.build }} | ||
|
||
steps: | ||
- name: Checkout scikit-longitudinal | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- id: check_build_trigger | ||
name: Check build trigger | ||
run: bash build_tools/github/check_build_trigger.sh | ||
|
||
unit_testing: | ||
runs-on: ${{ matrix.os }} | ||
needs: check_build_trigger | ||
if: needs.check_build_trigger.outputs.build | ||
strategy: | ||
matrix: | ||
python-version: [ 3.9 ] | ||
os: [ ubuntu-latest ] | ||
|
||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Checkout this repository | ||
uses: actions/checkout@v2 | ||
|
||
- uses: pdm-project/setup-pdm@main | ||
name: Setup PDM | ||
with: | ||
python-version: 3.9 | ||
architecture: x64 | ||
prerelease: false | ||
enable-pep582: true | ||
|
||
- name: Install dependencies from pdm.lock | ||
run: | | ||
pdm install | ||
- name: Run tests | ||
run: pdm run tests | ||
|
||
pypi-publish: | ||
name: ☁️ upload release to PyPI | ||
runs-on: ubuntu-latest | ||
needs: [check_build_trigger, unit_testing] | ||
if: | | ||
always() && | ||
needs.check_build_trigger.outputs.build && | ||
needs.unit_testing.result == 'success' | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: pdm-project/setup-pdm@v3 | ||
|
||
- name: Publish package distributions to PyPI | ||
run: pdm publish |
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,41 @@ | ||
include *.rst | ||
include LICENSE | ||
include README.md | ||
include pyproject.toml | ||
include setup.py | ||
include .coveragerc | ||
include .flake8 | ||
include .dockerignore | ||
include .gitignore | ||
include .nojekyll | ||
include .pre-commit-config.yaml | ||
include CHANGELOG.MD | ||
include CITATION.cff | ||
include dockerfile | ||
include logo.png | ||
include mkdocs.yml | ||
include mkgendocs.yml | ||
include pdm.lock | ||
include pylintrc | ||
include pytest.ini | ||
|
||
recursive-include scikit_longitudinal *.py *.c *.cpp *.h *.pyx *.pxd *.pxi *.tp | ||
recursive-include docs * | ||
|
||
# Exclude unnecessary directories and files | ||
recursive-exlude scikit_longitudinal/tests * | ||
recursive-exclude .cache * | ||
recursive-exclude .github * | ||
recursive-exclude __pypackages__ * | ||
recursive-exclude dist * | ||
recursive-exclude .pdm-build * | ||
recursive-exclude .pytest_cache * | ||
recursive-exclude .run * | ||
recursive-exclude .venv * | ||
recursive-exclude htmlcov * | ||
recursive-exclude .coverage * | ||
recursive-exclude .coverage.* * | ||
recursive-exclude workflows * | ||
exclude .unit-test-ci.yml | ||
exclude documentation-deploy.yml | ||
exclude publish-pypi.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
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,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
COMMIT_MSG=$(git log --no-merges -1 --oneline) | ||
|
||
# The commit marker "[cd build]" or "[cd build gh]" will trigger the build when required | ||
if [[ "$GITHUB_EVENT_NAME" == schedule || | ||
"$COMMIT_MSG" =~ \[cd\ build\] || | ||
"$COMMIT_MSG" =~ \[cd\ build\ gh\] ]]; then | ||
echo "build=true" >> $GITHUB_OUTPUT | ||
fi |
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,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
COMMIT_MSG=$(git log --no-merges -1 --oneline) | ||
|
||
# The commit marker "[cd build]" or "[cd build gh]" will trigger the build when required | ||
if [[ "$COMMIT_MSG" =~ \[cd\ tests\] ]]; then | ||
echo "tests=true" >> $GITHUB_OUTPUT | ||
fi |
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
Oops, something went wrong.