From 4cb2ed169f72b132e18d5b8eb0f68e4c3cf6fb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Wed, 14 Feb 2024 20:03:58 +0100 Subject: [PATCH 01/18] Update set-output --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4ba6fc..7f00b52 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,7 @@ jobs: python -m pip install -U pip - name: get pip cache dir id: pip-cache - run: echo "::set-output name=dir::$(pip cache dir)" + run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - name: cache pip uses: actions/cache@v4 with: From 6557f3f5876b83938a7125cc105d3123d85b0772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 15:38:37 +0100 Subject: [PATCH 02/18] Update workflows --- {.github/workflows => .archive}/tests.yml | 2 +- .github/workflows/main.yml | 165 ++++++++++++++++++++++ .pre-commit-config.yaml | 2 +- README.md | 4 +- 4 files changed, 169 insertions(+), 4 deletions(-) rename {.github/workflows => .archive}/tests.yml (96%) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/tests.yml b/.archive/tests.yml similarity index 96% rename from .github/workflows/tests.yml rename to .archive/tests.yml index 7f00b52..d4ba6fc 100644 --- a/.github/workflows/tests.yml +++ b/.archive/tests.yml @@ -40,7 +40,7 @@ jobs: python -m pip install -U pip - name: get pip cache dir id: pip-cache - run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + run: echo "::set-output name=dir::$(pip cache dir)" - name: cache pip uses: actions/cache@v4 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..efe631b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,165 @@ +name: Main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: + - main + push: + branches: + - main + tags: + - "v*.*.*" + +env: + # Change this to invalidate existing cache. + CACHE_PREFIX: v0 + PYTHONPATH: ./ + +jobs: + tests: + runs-on: ${{ matrix.os }} + name: Python ${{ matrix.python }} - ${{ matrix.task.name }} + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python: ["3.12", "3.11", "3.10"] + # task: + # - name: Test + # os: [windows-latest, ubuntu-latest, macos-latest] + # run: | + # pytest -v --color=yes tests/ + # - name: Build + # os: [windows-latest, ubuntu-latest, macos-latest] + # run: python -m build + + include: + - task: + name: Test + os: [windows-latest, ubuntu-latest, macos-latest] + run: | + pytest -v --color=yes tests/ + - task: + name: Build + os: [windows-latest, ubuntu-latest, macos-latest] + run: python -m build + + - python: "3.12" + task: + name: pre-commit + run: | + pip install pre-commit + pre-commit run --all-files + + - python: "3.12" + task: + name: Lint + run: ruff check . + + - python: "3.12" + task: + name: Type check + run: mypy . + + - python: "3.12" + task: + name: Style + run: black --check . + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python environment + uses: ./.github/actions/setup-venv + with: + python-version: ${{ matrix.python }} + cache-prefix: ${{ env.CACHE_PREFIX }} + + - name: Restore mypy cache + if: matrix.task.name == 'Type check' + uses: actions/cache@v4 + with: + path: .mypy_cache + key: + mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python + }}-${{ hashFiles('*requirements.txt') }}-${{ github.ref }}-${{ + github.sha }} + restore-keys: | + mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }}-${{ github.ref }} + mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }} + + - name: ${{ matrix.task.name }} + run: | + . .venv/bin/activate + ${{ matrix.task.run }} + + - name: Upload package distribution files + if: matrix.task.name == 'Build' + uses: actions/upload-artifact@v4 + with: + name: package + path: dist + + - name: Clean up + if: always() + run: | + . .venv/bin/activate + pip uninstall -y pte-stats + + release: + name: Release + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + runs-on: ubuntu-latest + needs: [tests] + environment: + name: pypi + url: https://pypi.org/p/ # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install requirements + run: | + pip install --upgrade pip + pip install -e .[dev] + + - name: Prepare environment + run: | + echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Download package distribution files + uses: actions/download-artifact@v4 + with: + name: package + path: dist + + - name: Generate release notes + run: | + python scripts/release_notes.py > ${{ github.workspace }}-RELEASE_NOTES.md + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - name: Publish GitHub release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + body_path: ${{ github.workspace }}-RELEASE_NOTES.md + prerelease: ${{ contains(env.TAG, 'rc') }} + files: | + dist/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d084da..6a64515 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -84,7 +84,7 @@ repos: - id: validate-pyproject - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.0 + rev: 0.28.0 hooks: - id: check-dependabot - id: check-github-workflows diff --git a/README.md b/README.md index 570c82b..9834859 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,9 @@ PTE Stats is licensed under the [MIT license](license-url). https://img.shields.io/static/v1?label=PyPi&message=v0.2.0&logoColor=black&labelColor=grey&color=blue [pypi-url]: https://pypi.org/project/pte-stats/ [tests-shield]: - https://github.com/richardkoehler/pte-stats/actions/workflows/tests.yml/badge.svg + https://github.com/richardkoehler/pte-stats/actions/workflows/main.yml/badge.svg [tests-url]: - https://github.com/richardkoehler/pte-stats/actions/workflows/tests.yml + https://github.com/richardkoehler/pte-stats/actions/workflows/main.yml [homepage-shield]: https://img.shields.io/static/v1?label=Homepage&message=ICN&logoColor=black&labelColor=grey&color=9cf [homepage-url]: https://www.icneuromodulation.org/ From 76bd92dd31835d1be5a844fd325e506b59d1270c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 15:52:23 +0100 Subject: [PATCH 03/18] Fix main workflow --- .github/workflows/main.yml | 3 ++- pyproject.toml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index efe631b..b2fa3be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,10 +44,11 @@ jobs: os: [windows-latest, ubuntu-latest, macos-latest] run: | pytest -v --color=yes tests/ + - task: name: Build os: [windows-latest, ubuntu-latest, macos-latest] - run: python -m build + run: hatch build - python: "3.12" task: diff --git a/pyproject.toml b/pyproject.toml index e098665..6f46305 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "black", + "hatch", "mypy", "packaging", "pandas-stubs", From c11a5e701bec41c487d4a08e0004050eb21cfa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 15:57:41 +0100 Subject: [PATCH 04/18] Fix workflow --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2fa3be..8482490 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,9 +45,9 @@ jobs: run: | pytest -v --color=yes tests/ - - task: + - python: "3.12" + task: name: Build - os: [windows-latest, ubuntu-latest, macos-latest] run: hatch build - python: "3.12" From 236ec348f11e9f2647b5900a8a15268e9aa2229b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 16:00:13 +0100 Subject: [PATCH 05/18] Fix workflow, remove test --- .github/workflows/main.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8482490..31ec9d3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,21 +29,14 @@ jobs: matrix: os: [ubuntu-latest] python: ["3.12", "3.11", "3.10"] - # task: - # - name: Test - # os: [windows-latest, ubuntu-latest, macos-latest] - # run: | - # pytest -v --color=yes tests/ - # - name: Build - # os: [windows-latest, ubuntu-latest, macos-latest] - # run: python -m build include: - - task: - name: Test - os: [windows-latest, ubuntu-latest, macos-latest] - run: | - pytest -v --color=yes tests/ + # Do not test until tests are up to date + # - task: + # name: Test + # os: [windows-latest, ubuntu-latest, macos-latest] + # run: | + # pytest -v --color=yes tests/ - python: "3.12" task: From 294d209e5e651342f0e37295e3894d3e8f001317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:07:39 +0100 Subject: [PATCH 06/18] Update workflow --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 31ec9d3..94454f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,14 +21,14 @@ env: jobs: tests: - runs-on: ${{ matrix.os }} name: Python ${{ matrix.python }} - ${{ matrix.task.name }} + runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: fail-fast: false matrix: os: [ubuntu-latest] - python: ["3.12", "3.11", "3.10"] + # python: ["3.12", "3.11", "3.10"] include: # Do not test until tests are up to date From 9b4d53eb20e5f83984f32e28a10a00b4b12cc32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:09:40 +0100 Subject: [PATCH 07/18] Update workflow --- .github/workflows/main.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94454f4..bd305bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - # python: ["3.12", "3.11", "3.10"] + python: ["3.12"] include: # Do not test until tests are up to date @@ -38,30 +38,25 @@ jobs: # run: | # pytest -v --color=yes tests/ - - python: "3.12" - task: + - task: name: Build run: hatch build - - python: "3.12" - task: + - task: name: pre-commit run: | pip install pre-commit pre-commit run --all-files - - python: "3.12" - task: + - task: name: Lint run: ruff check . - - python: "3.12" - task: + - task: name: Type check run: mypy . - - python: "3.12" - task: + - task: name: Style run: black --check . From 4b9e3fe87a657fa991631e5832c06bca5ca3225f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:13:02 +0100 Subject: [PATCH 08/18] Update workflow --- .github/workflows/main.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd305bd..e2ae9d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,25 +38,30 @@ jobs: # run: | # pytest -v --color=yes tests/ - - task: + - id: 1 + task: name: Build run: hatch build - - task: - name: pre-commit + - id: 2 + task: + name: Pre-commit run: | pip install pre-commit pre-commit run --all-files - - task: + - id: 3 + task: name: Lint run: ruff check . - - task: + - id: 4 + task: name: Type check run: mypy . - - task: + - id: 5 + task: name: Style run: black --check . From f8eba8cfb687850a6d610a2b59fb14f7643e7097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:25:19 +0100 Subject: [PATCH 09/18] Update workflow --- .github/actions/setup-venv/action.yml | 4 ++-- .github/workflows/main.yml | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-venv/action.yml b/.github/actions/setup-venv/action.yml index 2253ebe..11b64f3 100644 --- a/.github/actions/setup-venv/action.yml +++ b/.github/actions/setup-venv/action.yml @@ -12,7 +12,7 @@ runs: using: composite steps: - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} @@ -26,7 +26,7 @@ runs: # Get the exact Python version to use in the cache key. echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_ENV - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: virtualenv-cache with: path: .venv diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2ae9d8..ac6f6bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ env: jobs: tests: - name: Python ${{ matrix.python }} - ${{ matrix.task.name }} + name: ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.id }} runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: @@ -37,29 +37,24 @@ jobs: # os: [windows-latest, ubuntu-latest, macos-latest] # run: | # pytest -v --color=yes tests/ - - id: 1 task: name: Build run: hatch build - - id: 2 task: name: Pre-commit run: | pip install pre-commit pre-commit run --all-files - - id: 3 task: name: Lint run: ruff check . - - id: 4 task: name: Type check run: mypy . - - id: 5 task: name: Style From 19a3ff68cd6dd1d2a1c5c7779faec77136443b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:29:32 +0100 Subject: [PATCH 10/18] o rk python: "3.12" --- .github/workflows/main.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ac6f6bb..eb82653 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,14 +21,15 @@ env: jobs: tests: - name: ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.id }} + name: + ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.task.name }} runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: fail-fast: false matrix: - os: [ubuntu-latest] - python: ["3.12"] + # os: [ubuntu-latest] + # python: ["3.12"] include: # Do not test until tests are up to date @@ -37,25 +38,30 @@ jobs: # os: [windows-latest, ubuntu-latest, macos-latest] # run: | # pytest -v --color=yes tests/ - - id: 1 + - os: ubuntu-latest + python: "3.12" task: name: Build run: hatch build - - id: 2 + - os: ubuntu-latest + python: "3.12" task: name: Pre-commit run: | pip install pre-commit pre-commit run --all-files - - id: 3 + - os: ubuntu-latest + python: "3.12" task: name: Lint run: ruff check . - - id: 4 + - os: ubuntu-latest + python: "3.12" task: name: Type check run: mypy . - - id: 5 + - os: ubuntu-latest + python: "3.12" task: name: Style run: black --check . From f93796c251edc0a298077956949df0e1795f6b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:32:36 +0100 Subject: [PATCH 11/18] Update workflow --- .github/workflows/main.yml | 55 +++++++++++++------------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eb82653..d76e991 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,16 +21,14 @@ env: jobs: tests: - name: - ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.task.name }} + name: ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.name }} runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: fail-fast: false matrix: - # os: [ubuntu-latest] - # python: ["3.12"] - + os: [ubuntu-latest] + python: ["3.12"] include: # Do not test until tests are up to date # - task: @@ -38,33 +36,18 @@ jobs: # os: [windows-latest, ubuntu-latest, macos-latest] # run: | # pytest -v --color=yes tests/ - - os: ubuntu-latest - python: "3.12" - task: - name: Build - run: hatch build - - os: ubuntu-latest - python: "3.12" - task: - name: Pre-commit - run: | - pip install pre-commit - pre-commit run --all-files - - os: ubuntu-latest - python: "3.12" - task: - name: Lint - run: ruff check . - - os: ubuntu-latest - python: "3.12" - task: - name: Type check - run: mypy . - - os: ubuntu-latest - python: "3.12" - task: - name: Style - run: black --check . + - name: Build + run: hatch build + - name: Pre-commit + run: | + pip install pre-commit + pre-commit run --all-files + - name: Lint + run: ruff check . + - name: Type check + run: mypy . + - name: Style + run: black --check . steps: - uses: actions/checkout@v4 @@ -76,7 +59,7 @@ jobs: cache-prefix: ${{ env.CACHE_PREFIX }} - name: Restore mypy cache - if: matrix.task.name == 'Type check' + if: matrix.name == 'Type check' uses: actions/cache@v4 with: path: .mypy_cache @@ -88,13 +71,13 @@ jobs: mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }}-${{ github.ref }} mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }} - - name: ${{ matrix.task.name }} + - name: ${{ matrix.name }} run: | . .venv/bin/activate - ${{ matrix.task.run }} + ${{ matrix.run }} - name: Upload package distribution files - if: matrix.task.name == 'Build' + if: matrix.name == 'Build' uses: actions/upload-artifact@v4 with: name: package From 8578ee68530700401abd82e055fbbba812930bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:41:12 +0100 Subject: [PATCH 12/18] # - task: # name: Test # os: [windows-latest, ubuntu-latest, macos-latest] # run: | # pytest -v --color=yes tests/ Update workflow --- .github/workflows/main.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d76e991..f3e2b81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,8 @@ env: jobs: tests: - name: ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.name }} + name: + ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.task.name }} runs-on: ${{ matrix.os }} timeout-minutes: 15 strategy: @@ -29,13 +30,13 @@ jobs: matrix: os: [ubuntu-latest] python: ["3.12"] + task: + - name: Test + run: + . + # pytest -v --color=yes tests/ include: # Do not test until tests are up to date - # - task: - # name: Test - # os: [windows-latest, ubuntu-latest, macos-latest] - # run: | - # pytest -v --color=yes tests/ - name: Build run: hatch build - name: Pre-commit @@ -71,13 +72,13 @@ jobs: mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }}-${{ github.ref }} mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }} - - name: ${{ matrix.name }} + - name: ${{ matrix.task.name }} run: | . .venv/bin/activate - ${{ matrix.run }} + ${{ matrix.task.run }} - name: Upload package distribution files - if: matrix.name == 'Build' + if: matrix.task.name == 'Build' uses: actions/upload-artifact@v4 with: name: package From 4d1b2088222d7feadfed6adb2cd656885571a226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:43:46 +0100 Subject: [PATCH 13/18] Update workflow --- .github/workflows/main.yml | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3e2b81..4e4a66e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,19 +36,28 @@ jobs: . # pytest -v --color=yes tests/ include: - # Do not test until tests are up to date - - name: Build - run: hatch build - - name: Pre-commit - run: | - pip install pre-commit - pre-commit run --all-files - - name: Lint - run: ruff check . - - name: Type check - run: mypy . - - name: Style - run: black --check . + - python: "3.11" + task: + name: Lint + run: ruff check . + + - python: "3.11" + task: + name: Type check + run: mypy . + + - python: "3.11" + task: + name: Build + run: | + python -m build + + - python: "3.11" + task: + name: Style + run: | + isort --check . + black --check . steps: - uses: actions/checkout@v4 @@ -60,14 +69,14 @@ jobs: cache-prefix: ${{ env.CACHE_PREFIX }} - name: Restore mypy cache - if: matrix.name == 'Type check' + if: matrix.task.name == 'Type check' uses: actions/cache@v4 with: path: .mypy_cache key: - mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python - }}-${{ hashFiles('*requirements.txt') }}-${{ github.ref }}-${{ - github.sha }} + mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ + matrix.python}}-${{ hashFiles('*requirements.txt') }}-${{ github.ref + }}-${{github.sha }} restore-keys: | mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }}-${{ github.ref }} mypy-${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('*requirements.txt') }} From e730557165cf85bafc9b4ace017286d407153d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:44:36 +0100 Subject: [PATCH 14/18] Update workflow --- .github/workflows/main.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4e4a66e..772b3a3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,28 +36,25 @@ jobs: . # pytest -v --color=yes tests/ include: - - python: "3.11" + - python: "3.12" task: name: Lint run: ruff check . - - python: "3.11" + - python: "3.12" task: name: Type check run: mypy . - - python: "3.11" + - python: "3.12" task: name: Build - run: | - python -m build + run: hatch build - - python: "3.11" + - python: "3.12" task: name: Style - run: | - isort --check . - black --check . + run: black --check . steps: - uses: actions/checkout@v4 From 603562a8accde83c645cddbbe4c202ddcff3e841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:46:43 +0100 Subject: [PATCH 15/18] Update workflow --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 772b3a3..3d29ef8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,12 +23,12 @@ jobs: tests: name: ${{ matrix.os }} - Python ${{ matrix.python }} - ${{ matrix.task.name }} - runs-on: ${{ matrix.os }} + runs-on: [ubuntu-latest] timeout-minutes: 15 strategy: fail-fast: false matrix: - os: [ubuntu-latest] + # os: [ubuntu-latest] python: ["3.12"] task: - name: Test From 5d8a0cbb1bbc9bd1bce6df04461da221539068e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 18:49:35 +0100 Subject: [PATCH 16/18] Update workflow --- .github/workflows/main.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3d29ef8..df09dad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,29 +33,25 @@ jobs: task: - name: Test run: - . + ":" # pytest -v --color=yes tests/ include: - python: "3.12" task: name: Lint run: ruff check . - - python: "3.12" task: name: Type check run: mypy . - - python: "3.12" task: name: Build run: hatch build - - python: "3.12" task: name: Style run: black --check . - steps: - uses: actions/checkout@v4 From 4fc63d68f197b7a390144b55d5c2a061c766d097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 19:02:51 +0100 Subject: [PATCH 17/18] Bump version to v0.3.0rc1 for release --- .github/workflows/main.yml | 3 +-- docs/CHANGELOG.md | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df09dad..87360e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,6 @@ jobs: strategy: fail-fast: false matrix: - # os: [ubuntu-latest] python: ["3.12"] task: - name: Test @@ -99,7 +98,7 @@ jobs: needs: [tests] environment: name: pypi - url: https://pypi.org/p/ # Replace with your PyPI project name + url: https://pypi.org/p/pte-stats permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 881eb4d..9f4353a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,10 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## Unreleased + +## [v0.3.0rc1](https://github.com/richardkoehler/pte-stats/releases/tag/v0.3.0rc1) - 2024-02-15 ### Added +- Minor additions + ### Fixed ### Changed @@ -18,7 +22,13 @@ and this project adheres to ### Removed -## [0.1.0] - 2022-02-01 +## [0.2.0](https://github.com/richardkoehler/pte-stats/releases/tag/v0.2.0) - 2023-01-12 + +### Added + +- Minor additions + +## [0.1.0](https://github.com/richardkoehler/pte-stats/releases/tag/v0.1.0) - 2022-02-01 ### Added From a5dd18dbdbe173be485afd20131d35cdae67f600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20M=2E=20K=C3=B6hler?= Date: Thu, 15 Feb 2024 19:22:10 +0100 Subject: [PATCH 18/18] Bump version to v0.3.0 for release --- .github/workflows/main.yml | 1 + .pre-commit-config.yaml | 8 ++++---- README.md | 8 ++------ docs/CHANGELOG.md | 10 ++++++---- scripts/release.sh | 19 +++++++++++++++++++ src/pte_stats/__init__.py | 2 +- 6 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 scripts/release.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87360e6..926e8e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,6 +101,7 @@ jobs: url: https://pypi.org/p/pte-stats permissions: id-token: write # IMPORTANT: mandatory for trusted publishing + contents: write steps: - uses: actions/checkout@v4 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a64515..c3dbd33 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,10 +65,10 @@ repos: hooks: - id: codespell - - repo: https://github.com/shellcheck-py/shellcheck-py - rev: "v0.9.0.6" - hooks: - - id: shellcheck + # - repo: https://github.com/shellcheck-py/shellcheck-py + # rev: "v0.9.0.6" + # hooks: + # - id: shellcheck - repo: local hooks: diff --git a/README.md b/README.md index 9834859..9735146 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![Tests][tests-shield]][tests-url] [![License][license-shield]][license-url] [![Contributors][contributors-shield]][contributors-url] [![Code Style][codestyle-shield]][codestyle-url] -[![Homepage][homepage-shield]][homepage-url] # PTE Stats - Python tools for electrophysiology @@ -89,18 +88,15 @@ PTE Stats is licensed under the [MIT license](license-url). [python-shield]: - https://img.shields.io/static/v1?label=Python&message=3.10&logoColor=black&labelColor=grey&color=blue + https://img.shields.io/static/v1?label=Python&message=3.12&logoColor=black&labelColor=grey&color=blue [python-url]: https://pypi.org/project/pte-stats/ [pypi-shield]: - https://img.shields.io/static/v1?label=PyPi&message=v0.2.0&logoColor=black&labelColor=grey&color=blue + https://img.shields.io/static/v1?label=PyPi&message=v0.3.0&logoColor=black&labelColor=grey&color=blue [pypi-url]: https://pypi.org/project/pte-stats/ [tests-shield]: https://github.com/richardkoehler/pte-stats/actions/workflows/main.yml/badge.svg [tests-url]: https://github.com/richardkoehler/pte-stats/actions/workflows/main.yml -[homepage-shield]: - https://img.shields.io/static/v1?label=Homepage&message=ICN&logoColor=black&labelColor=grey&color=9cf -[homepage-url]: https://www.icneuromodulation.org/ [contributors-shield]: https://img.shields.io/github/contributors/richardkoehler/pte-stats.svg [contributors-url]: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9f4353a..b506add 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,12 +8,8 @@ and this project adheres to ## Unreleased -## [v0.3.0rc1](https://github.com/richardkoehler/pte-stats/releases/tag/v0.3.0rc1) - 2024-02-15 - ### Added -- Minor additions - ### Fixed ### Changed @@ -22,6 +18,12 @@ and this project adheres to ### Removed +## [v0.3.0](https://github.com/richardkoehler/pte-stats/releases/tag/v0.3.0) - 2024-02-15 + +## [v0.3.0rc1](https://github.com/richardkoehler/pte-stats/releases/tag/v0.3.0rc1) - 2024-02-15 + +- Minor additions + ## [0.2.0](https://github.com/richardkoehler/pte-stats/releases/tag/v0.2.0) - 2023-01-12 ### Added diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 0000000..659cab6 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +TAG=$(python -c 'from pte_stats import __version__; print("v" + __version__)') + +read -p "Creating new release for $TAG. Do you want to continue? [Y/n] " prompt + +if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then + python scripts/prepare_changelog.py + git add -A + git commit -m "Bump version to $TAG for release" || true && git push + echo "Creating new git tag $TAG" + git tag "$TAG" -m "$TAG" + git push --tags +else + echo "Cancelled" + exit 1 +fi diff --git a/src/pte_stats/__init__.py b/src/pte_stats/__init__.py index b56df14..0214e90 100644 --- a/src/pte_stats/__init__.py +++ b/src/pte_stats/__init__.py @@ -1,6 +1,6 @@ """An open-source software package for statistics with time series. """ -__version__ = "0.3.0rc1" +__version__ = "0.3.0" from .cluster import ( cluster_analysis_1d,