-
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.
- Loading branch information
0 parents
commit e45d1a6
Showing
69 changed files
with
2,568 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Ruff | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ruff | ||
# Update output format to enable automatic inline annotations. | ||
- name: Run Ruff | ||
run: ruff check --output-format=github . |
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,181 @@ | ||
name: Update Version | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
bump: | ||
description: 'The version bump to apply [possible values: major, minor, patch]' | ||
required: true | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
package: | ||
description: 'The package to update [possible values: all, darts-acquisition, darts-ensemble, darts-pipeline, darts-preprocessing, darts-segmentation, darts-superresolution]' | ||
required: true | ||
type: choice | ||
options: | ||
- all | ||
- darts-acquisition | ||
- darts-ensemble | ||
- darts-pipeline | ||
- darts-preprocessing | ||
- darts-segmentation | ||
- darts-superresolution | ||
publish: | ||
description: 'Publish the package to PyPI and GitHub releases' | ||
required: false | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
update-version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
enable-cache: true | ||
version: '0.39.0' | ||
|
||
# Do a version bump to the package | ||
- name: Update version in pyproject.toml | ||
run: | | ||
if [ ${{ github.event.inputs.package }} == 'all' ]; then | ||
rye version --bump ${{ github.event.inputs.bump }} | ||
cd darts-acquisition && rye version --bump ${{ github.event.inputs.bump }} | ||
cd ../darts-ensemble && rye version --bump ${{ github.event.inputs.bump }} | ||
cd ../darts-pipeline && rye version --bump ${{ github.event.inputs.bump }} | ||
cd ../darts-preprocessing && rye version --bump ${{ github.event.inputs.bump }} | ||
cd ../darts-segmentation && rye version --bump ${{ github.event.inputs.bump }} | ||
cd ../darts-superresolution && rye version --bump ${{ github.event.inputs.bump }} | ||
else | ||
rye version --bump ${{ github.event.inputs.bump }} | ||
cd ${{ github.event.inputs.package }} && rye version --bump ${{ github.event.inputs.bump }} | ||
fi | ||
# Get the new version with rye version and save it as an variable | ||
- name: Get new version | ||
id: get_version | ||
run: echo "VERSION=$(rye version)" >> $GITHUB_OUTPUT | ||
|
||
- name: Commit changes | ||
run: | | ||
git config --global user.name 'github-actions' | ||
git config --global user.email '[email protected]' | ||
git add pyproject.toml | ||
git commit -m "${{ github.event.inputs.bump }} version bump to ${{ steps.get_version.outputs.VERSION }} of ${{ github.event.inputs.package }}" | ||
git push | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- update-version | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
if: github.event.inputs.publish == true | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
enable-cache: true | ||
version: '0.39.0' | ||
|
||
- name: Build package | ||
run: | | ||
if [ ${{ github.event.inputs.package }} == 'all' ]; then | ||
cd darts-acquisition && rye build && cd .. | ||
cd darts-ensemble && rye build && cd .. | ||
cd darts-pipeline && rye build && cd .. | ||
cd darts-preprocessing && rye build && cd .. | ||
cd darts-segmentation && rye build && cd .. | ||
cd darts-superresolution && rye build && cd .. | ||
else | ||
cd ${{ github.event.inputs.package }} && rye build && cd .. | ||
fi | ||
# - name: Publish to PyPI | ||
# run: | | ||
# if [ ${{ github.event.inputs.package }} == 'all' ]; then | ||
# cd darts-acquisition && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# cd darts-ensemble && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# cd darts-pipeline && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# cd darts-preprocessing && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# cd darts-segmentation && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# cd darts-superresolution && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# else | ||
# cd ${{ github.event.inputs.package }} && rye publish --token ${{ secrets.PYPI_TOKEN }} --yes && cd .. | ||
# fi | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.get_version.outputs.VERSION }} | ||
release_name: Release ${{ steps.get_version.outputs.VERSION }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload packages to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
for file in ${{ github.event.inputs.package }}/dist/*.{whl,tar.gz}; do | ||
echo "Uploading $file..." | ||
curl -sSL \ | ||
-X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Content-Type: $(file -b --mime-type $file)" \ | ||
--data-binary @$file \ | ||
"${{ steps.create_release.outputs.upload_url }}?name=$(basename $file)" | ||
done | ||
build-and-publish-docs: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- update-version | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Get cache id | ||
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material | ||
- name: Install dependencies | ||
run: | | ||
pip install "mkdocs-material[imaging]>=9.5.38" "mkdocstrings[python]>=0.26.1" "mike>=2.1.3" "mkdocs-git-revision-date-localized-plugin>=1.2.9" "mkdocs-git-committers-plugin-2>=2.3.0" | ||
- name: Publish documentation | ||
run: mike deploy --push --update-aliases ${{ steps.get_version.outputs.VERSION }} latest |
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,24 @@ | ||
# python generated files | ||
__pycache__/ | ||
*.py[oc] | ||
build/ | ||
dist/ | ||
wheels/ | ||
*.egg-info | ||
|
||
# venv | ||
.venv | ||
|
||
# artifacts | ||
models | ||
data | ||
logs | ||
|
||
# Mkdocs | ||
.cache | ||
|
||
# Ruff | ||
.ruff_cache | ||
|
||
# Tobis playgrounds | ||
notebooks/playground.ipynb |
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 @@ | ||
3.11.9 |
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,14 @@ | ||
{ | ||
"recommendations": [ | ||
"aaron-bond.better-comments", | ||
"usernamehw.errorlens", | ||
"tamasfe.even-better-toml", | ||
"ms-toolsai.jupyter", | ||
"yzhang.markdown-all-in-one", | ||
"davidanson.vscode-markdownlint", | ||
"ms-python.python", | ||
"charliermarsh.ruff", | ||
"redhat.vscode-yaml", | ||
"njpwerner.autodocstring" | ||
] | ||
} |
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,43 @@ | ||
{ | ||
"[markdown]": { | ||
"editor.defaultFormatter": "yzhang.markdown-all-in-one", | ||
"editor.formatOnSave": true, | ||
"editor.wordWrap": "off", | ||
"files.trimTrailingWhitespace": false | ||
}, | ||
"[python]": { | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"source.organizeImports": "explicit" | ||
}, | ||
"editor.defaultFormatter": "charliermarsh.ruff", | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 4, | ||
"files.trimTrailingWhitespace": true | ||
}, | ||
"[toml]": { | ||
"editor.formatOnSave": false | ||
}, | ||
"[yaml]": { | ||
"editor.defaultFormatter": "redhat.vscode-yaml" | ||
}, | ||
"files.eol": "\n", | ||
"notebook.codeActionsOnSave": { | ||
"notebook.source.fixAll": "explicit", | ||
"notebook.source.organizeImports": "explicit" | ||
}, | ||
"notebook.formatOnSave.enabled": true, | ||
"yaml.format.printWidth": 120, | ||
"yaml.format.singleQuote": true, | ||
"yaml.schemas": { | ||
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml" | ||
}, | ||
"yaml.customTags": [ | ||
"!ENV scalar", | ||
"!ENV sequence", | ||
"!relative scalar", | ||
"tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg", | ||
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji", | ||
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format" | ||
] | ||
} |
Oops, something went wrong.