diff --git a/.github/workflows/bump-version-dev.yml b/.github/workflows/bump-version-dev.yml index b42cab9bc..c84a8fae9 100644 --- a/.github/workflows/bump-version-dev.yml +++ b/.github/workflows/bump-version-dev.yml @@ -12,48 +12,31 @@ jobs: name: Bump version runs-on: ubuntu-latest + permissions: + contents: write + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: '3.10' - name: Set env variables run: | - # The next line is very important, otherwise the line after triggers - # git to track the permission change, which breaks bump2version API (needs clean git folder) - git config core.filemode false - chmod +x .github/workflows/utils.sh - echo "VERSION_FILE=porespy/__version__.py" >> $GITHUB_ENV - echo "SETUP_CFG_FILE=setup.cfg" >> $GITHUB_ENV echo "${{ github.event.head_commit.message }}" - name: Install dependencies run: | - pip install bump2version + pip install -e .[build] - - name: Bump version (build) + - name: Bump version (dev) run: | - source .github/workflows/utils.sh - bump_version build $VERSION_FILE - # Note that we don't want to create a new tag for "builds" - - # - name: Commit files - # run: | - # REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY} - # remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PUSH_ACTION_TOKEN }}@github.com/${REPOSITORY}.git" - - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - - # # Commit version bump to dev ([no ci] to avoid infinite loop) - # git commit -m "Bump version number (build) [no ci]" -a - # git push "${remote_repo}" dev + hatch version dev - name: Commit files - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: Bump version number (build part) - commit_author: Author + commit_message: Bump version number (dev segment) + commit_author: GitHub Actions diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 9204db4d3..c3670006f 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -11,53 +11,44 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.10' - name: Set env variables run: | - # The next line is very important, otherwise the line after triggers - # git to track the permission change, which breaks bump2version API (needs clean git folder) - git config core.filemode false - chmod +x .github/workflows/utils.sh - echo "VERSION_FILE=porespy/__version__.py" >> $GITHUB_ENV - echo "SETUP_CFG_FILE=setup.cfg" >> $GITHUB_ENV echo "${{ github.event.head_commit.message }}" - name: Install dependencies run: | - pip install bump2version + pip install -e .[build] - name: Bump version (patch) if: contains(github.event.head_commit.message, '#patch') run: | - source .github/workflows/utils.sh - bump_version patch $VERSION_FILE - echo "TAG_NEW=v$(get_version $VERSION_FILE)" >> $GITHUB_ENV + hatch version patch + echo "TAG_NEW=v$(hatch version)" >> $GITHUB_ENV - name: Bump version (minor) if: contains(github.event.head_commit.message, '#minor') run: | - source .github/workflows/utils.sh - bump_version minor $VERSION_FILE - echo "TAG_NEW=v$(get_version $VERSION_FILE)" >> $GITHUB_ENV + hatch version minor + echo "TAG_NEW=v$(hatch version)" >> $GITHUB_ENV - name: Bump version (major) if: contains(github.event.head_commit.message, '#major') run: | - source .github/workflows/utils.sh - bump_version major $VERSION_FILE - echo "TAG_NEW=v$(get_version $VERSION_FILE)" >> $GITHUB_ENV + hatch version major + echo "TAG_NEW=v$(hatch version)" >> $GITHUB_ENV - name: Commit files - if: + if: | contains(github.event.head_commit.message, '#patch') || contains(github.event.head_commit.message, '#minor') || contains(github.event.head_commit.message, '#major') @@ -68,7 +59,7 @@ jobs: git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - # commit version bump to release + # Commit version bump to release git commit -m "Bump version number" -a git push "${remote_repo}" release @@ -77,7 +68,7 @@ jobs: with: source_branch: "release" # If blank, default: triggered branch destination_branch: "dev" # If blank, default: master - pr_title: "Don't forget to merge release back into dev!" + pr_title: "Merge release -> dev to propagate version number bump" pr_body: "Changes made to the release branch (e.g. hotfixes), plus the version bump." pr_assignee: "jgostick,ma-sadeghi" # Comma-separated list (no spaces) pr_label: "high priority" # Comma-separated list (no spaces) @@ -85,10 +76,6 @@ jobs: pr_allow_empty: true # Creates pull request even if there are no changes github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Trim the 4th digit from the tag - run: - echo "TAG_NEW=${TAG_NEW%.dev?}" >> $GITHUB_ENV - - name: Create new tag run: | REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY} diff --git a/.github/workflows/cleanup-tags.yml b/.github/workflows/cleanup-tags.yml index 618523a7d..171651473 100644 --- a/.github/workflows/cleanup-tags.yml +++ b/.github/workflows/cleanup-tags.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Clean up tags run: | diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 232e98bdd..d37c182a2 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -14,35 +14,33 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.8'] + python-version: ['3.10'] operating-system: [ubuntu-latest] # Next line should be [1, 2, ..., max-parallel) test_group: [1, 2, 3, 4, 5] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: FedericoCarboni/setup-ffmpeg@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v4 with: # This path is specific to Ubuntu path: ~/.cache/pip # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- - name: Install dependencies (pip) run: | - pip install -r requirements.txt - pip install -r requirements/tests.txt - pip install -r requirements/examples.txt + pip install -e .[test,extras] - name: Running tests # Make sure to pass max-parallel to --splits diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 14230c7ac..c918efad8 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -15,12 +15,12 @@ jobs: shell: bash -l {0} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: '3.10' - name: Cache pip uses: actions/cache@v2 @@ -28,15 +28,14 @@ jobs: # This path is specific to Ubuntu path: ~/.cache/pip # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- - name: Install dependencies (conda) run: | - pip install -r requirements.txt - pip install -r requirements/docs.txt + pip install -e .[docs,interactive] # Build the documentation - name: Build the documentation diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 58d3abcb5..f4c26166b 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,9 +1,10 @@ name: Deploy to PyPI on: + workflow_dispatch: push: tags: - - '*' + - 'v*' jobs: deploy: @@ -11,31 +12,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: - ref: release # the production branch name (for proper version #) + ref: release - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.10' - name: Set env variables run: | chmod +x .github/workflows/utils.sh source .github/workflows/utils.sh - VERSION_FILE=porespy/__version__.py echo "TAG=$(get_most_recent_tag)" >> $GITHUB_ENV - echo "VERSION=$(get_version $VERSION_FILE)" >> $GITHUB_ENV - - - name: Set env variables (for tag mismatch) - run: | - echo "Tag: $TAG, Version: $VERSION" - if [ "${TAG//v}" = "${VERSION%.dev?}" ]; then - echo "TAG_MISMATCH=false" >> $GITHUB_ENV - else - echo "TAG_MISMATCH=true" >> $GITHUB_ENV - fi + echo "VERSION=$(hatch version)" >> $GITHUB_ENV - name: Install dependencies run: | @@ -48,30 +39,9 @@ jobs: run: python setup.py sdist bdist_wheel - name: Publish distribution 📦 to PyPI - if: startsWith(github.event.ref, 'refs/tags') && contains(env.TAG_MISMATCH, 'false') - uses: pypa/gh-action-pypi-publish@master + if: startsWith(github.event.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} - skip_existing: true - -# - name: Publish distribution 📦 to TestPyPI -# if: startsWith(github.event.ref, 'refs/tags') && contains(env.TAG_MISMATCH, 'false') -# uses: pypa/gh-action-pypi-publish@master -# with: -# user: __token__ -# password: ${{ secrets.TESTPYPI_TOKEN }} -# repository_url: https://test.pypi.org/legacy/ - - # Not a good idea: if a non-conforming tag is push, e.g. random_tag, it - # first gets deleted by cleanup-tags.yml, and then publish-to-pypi.yml gets - # tricked and deletes the most recent tag! Ouch! - - # - name: Delete tag if doesn't match with version - # if: contains(env.TAG_MISMATCH, 'true') - # run: | - # git config --local user.email "action@github.com" - # git config --local user.name "GitHub Action" - # REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY} - # remote_repo="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${REPOSITORY}.git" - # git push "${remote_repo}" :refs/tags/$TAG + skip-existing: true diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 58cbe978b..1bac0edc6 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -12,26 +12,26 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: - fetch-depth: 0 # to retrieve entire history of refs/tags + fetch-depth: 0 # Retrieve entire history of refs/tags - - name: Generate release notes + - name: get-recent-tag run: | git fetch --all --tags --force chmod +x .github/workflows/logger.sh chmod +x .github/workflows/utils.sh source .github/workflows/utils.sh bash .github/workflows/logger.sh - echo "TAG=$(get_most_recent_tag)" >> $GITHUB_ENV + echo "TAG=$(get_most_recent_tag)" >> $GITHUB_OUTPUT - name: Create GitHub release - uses: Roang-zero1/github-create-release-action@master + uses: Roang-zero1/github-create-release-action@v3 with: version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ create_draft: true - created_tag: ${{ env.TAG }} + created_tag: ${{ steps.get-recent-tag.outputs.TAG }} update_existing: false - release_title: ${{ env.TAG }} + release_title: ${{ steps.get-recent-tag.outputs.TAG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-duration-logger.yml b/.github/workflows/test-duration-logger.yml index 3b113311f..6a46fb389 100644 --- a/.github/workflows/test-duration-logger.yml +++ b/.github/workflows/test-duration-logger.yml @@ -13,32 +13,30 @@ jobs: strategy: max-parallel: 1 matrix: - python-version: ['3.8'] + python-version: ['3.10'] os: [ubuntu-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v4 with: # This path is specific to Ubuntu path: ~/.cache/pip # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- - name: Install dependencies (pip) run: | - pip install wheel - pip install -r requirements.txt - pip install -r requirements/tests.txt + pip install -e .[test,extras] - name: Running unit tests and examples run: | @@ -52,9 +50,9 @@ jobs: --durations-path test/fixtures/.test_durations_unit - name: Committing test duration files - uses: EndBug/add-and-commit@v7 + uses: EndBug/add-and-commit@v9 with: add: 'test/fixtures' author_name: github-actions - author_email: 41898282+github-actions[bot]@users.noreply.github.com + author_email: actions@github.com message: 'Updated test duration files.' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 32121f76d..47b4218b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,11 +16,10 @@ jobs: strategy: fail-fast: false - max-parallel: 9 + max-parallel: 12 matrix: - # Add '3.10' to the list once #611 is addressed - python-version: ['3.8', '3.9', '3.10', '3.11'] - os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ['3.10', '3.11', '3.12'] + os: [ubuntu-latest, macos-14, macos-latest, windows-latest] include: - os: ubuntu-latest path: ~/.cache/pip @@ -31,29 +30,27 @@ jobs: steps: - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ matrix.path }} - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies (pip) run: | - pip install \ - -r requirements.txt \ - -r requirements/tests.txt + pip install -e .[test] # TODO: uncomment this step when integration tests are fixed # - name: Disable numba JIT for codecov to include jitted methods - # if: (matrix.python-version == 3.8) && (matrix.os == 'ubuntu-latest') + # if: (matrix.python-version == 3.10) && (matrix.os == 'ubuntu-latest') # run: | # echo "NUMBA_DISABLE_JIT=1" >> $GITHUB_ENV @@ -65,8 +62,8 @@ jobs: --pycodestyle - name: Upload coverage to Codecov - if: (matrix.python-version == 3.8) && (matrix.os == 'ubuntu-latest') - uses: codecov/codecov-action@v1 + if: (matrix.python-version == 3.10) && (matrix.os == 'ubuntu-latest') + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml diff --git a/.github/workflows/verify-pip-installation.yml b/.github/workflows/verify-pip-installation.yml index c00d57d45..e88a784ef 100644 --- a/.github/workflows/verify-pip-installation.yml +++ b/.github/workflows/verify-pip-installation.yml @@ -1,6 +1,10 @@ name: Verify pip-installability -on: [workflow_dispatch] +on: + schedule: + # Run (on default branch only) at 05:00 (hr:mm) UTC -> 12am EST + - cron: "0 5 * * *" + workflow_dispatch: jobs: deploy: @@ -8,11 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.10' - name: Set branch name as env variable run: |