From 2883132d81b502c578a3a897d9f5e00563c302f4 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 10 Dec 2025 17:03:25 +0100 Subject: [PATCH 1/5] .github/workflows/github-actions-ci.yml: Only run CI on and against the master branch --- .github/workflows/github-actions-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/github-actions-ci.yml b/.github/workflows/github-actions-ci.yml index e533a1b4..038654fb 100644 --- a/.github/workflows/github-actions-ci.yml +++ b/.github/workflows/github-actions-ci.yml @@ -2,11 +2,11 @@ name: ci/github-actions on: pull_request: - branches: [ master, feature/** ] - + branches: + - master push: - branches: [ master, feature/** ] - + branches: + - master jobs: run-light-tests: From 4d0ceed1745a5f29e9cc4b9e1989e9c4442eb592 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Wed, 10 Dec 2025 17:04:51 +0100 Subject: [PATCH 2/5] .github/workflows/github-actions-ci.yml: Tweak it We make it reusable via the workflow_call keyword and also don't run it on tags. --- .github/workflows/github-actions-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/github-actions-ci.yml b/.github/workflows/github-actions-ci.yml index 038654fb..87d52254 100644 --- a/.github/workflows/github-actions-ci.yml +++ b/.github/workflows/github-actions-ci.yml @@ -1,12 +1,15 @@ name: ci/github-actions on: + workflow_call: pull_request: branches: - master push: branches: - master + tags_ignore: + - '*' jobs: run-light-tests: From 7f2f99680ddb25888b3449feb17fb8ac4a08213d Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Fri, 8 Aug 2025 20:24:44 +0200 Subject: [PATCH 3/5] .github/workflows: Add deploy_release.yml Taken from pynwb in version 2c2bc850 (Remove python 3.8 support and add python 3.13 support (#2007), 2024-12-18). --- .github/workflows/deploy_release.yml | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/deploy_release.yml diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml new file mode 100644 index 00000000..fff052fb --- /dev/null +++ b/.github/workflows/deploy_release.yml @@ -0,0 +1,54 @@ +name: Deploy release +on: + push: + tags: # run only on new tags that follow semver MAJOR.MINOR.PATCH + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + deploy-release: + name: Deploy release from tag + runs-on: ubuntu-latest + steps: + - name: Checkout repo with submodules + uses: actions/checkout@v4 + with: + submodules: 'recursive' + fetch-depth: 0 # tags are required for versioneer to determine the version + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox + python -m pip list + + - name: Run tox tests + run: | + tox -e py312-upgraded + + - name: Build wheel and source distribution + run: | + tox -e build-py312-upgraded + ls -1 dist + + - name: Test installation from a wheel + run: | + tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl + + - name: Upload wheel and source distributions to PyPI + run: | + python -m pip install twine + ls -1 dist + # twine upload --repository-url https://test.pypi.org/legacy/ -u ${{ secrets.BOT_PYPI_USER }} -p ${{ secrets.BOT_PYPI_PASSWORD }} --skip-existing dist/* + twine upload -u ${{ secrets.BOT_PYPI_USER }} -p ${{ secrets.BOT_PYPI_PASSWORD }} --skip-existing dist/* + + - name: Publish wheel and source distributions as a GitHub release + run: | + python -m pip install "githubrelease>=1.5.9" + githubrelease --github-token ${{ secrets.BOT_GITHUB_TOKEN }} release NeurodataWithoutBorders/pynwb \ + create ${{ github.ref_name }} --name ${{ github.ref_name }} \ + --publish dist/* From 4f711e7064cd9dac72ae22722deaa5b7e6d4b904 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Fri, 8 Aug 2025 21:02:11 +0200 Subject: [PATCH 4/5] .github/workflows: Prefer pip directly --- .github/workflows/deploy_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml index fff052fb..f578e19a 100644 --- a/.github/workflows/deploy_release.yml +++ b/.github/workflows/deploy_release.yml @@ -41,7 +41,7 @@ jobs: - name: Upload wheel and source distributions to PyPI run: | - python -m pip install twine + pip install twine ls -1 dist # twine upload --repository-url https://test.pypi.org/legacy/ -u ${{ secrets.BOT_PYPI_USER }} -p ${{ secrets.BOT_PYPI_PASSWORD }} --skip-existing dist/* twine upload -u ${{ secrets.BOT_PYPI_USER }} -p ${{ secrets.BOT_PYPI_PASSWORD }} --skip-existing dist/* From e7007594d8d7592cd04d2184e592724bfa4e8ef8 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Fri, 8 Aug 2025 20:46:18 +0200 Subject: [PATCH 5/5] CI: Move release CI to github actions The release job depends on the test jobs so we don't have to duplicate the test run code. We also remove the .circleci configuration and adapt .github/workflows/deploy_release.yml as required. --- .circleci/config.yml | 138 --------------------------- .github/workflows/deploy_release.yml | 54 ++++++----- 2 files changed, 28 insertions(+), 164 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 430232ef..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,138 +0,0 @@ -# Python CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-python/ for more details -# -version: 2 -jobs: - build: - parallelism: 1 - environment: - TEST_INHOUSE: false - - docker: - # specify the version you desire here - # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: circleci/python:3.6 - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 - - working_directory: ~/repo - - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "requirements.txt" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: - name: install dependencies - command: | - python3 -m venv venv - . venv/bin/activate - pip install -U pip - pip install -U -r requirements.txt - pip install codecov - - - save_cache: - paths: - - ./venv - key: v1-dependencies-{{ checksum "requirements.txt" }} - - - run: - name: install test dependencies - command: | - . venv/bin/activate - pip install -r requirements-test.txt - - # run tests! - - run: - name: run tests - command: | - . venv/bin/activate - mkdir test-results - sudo apt-get -y install git-lfs - git lfs pull - py.test --junitxml=test-results/junit.xml --verbose - - - - store_test_results: - path: test-results - destination: tr2 - - - store_artifacts: - path: test-results - destination: tr1 - - - deploy_pypi: - docker: - - image: circleci/python:3.6 - working_directory: ~/repo - - steps: - - checkout - - - run: - name: configure pypirc - command: | - echo -e "[pypi]" >> ~/.pypirc - echo -e "username = $PYPI_USERNAME" >> ~/.pypirc - echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc - - - run: - name: setup_venv - command: | - python3 -m venv venv - . venv/bin/activate - pip install --upgrade pip - pip install -U cryptography - pip install -U twine setuptools wheel - - - run: - name: check_version - command: | - echo "CIRCLE_TAG: $CIRCLE_TAG" - . venv/bin/activate - python setup.py check_version -e $CIRCLE_TAG - - - run: - name: build wheels - command: | - . venv/bin/activate - python setup.py sdist - python setup.py bdist_wheel - - - run: - name: deploy - command: | - . venv/bin/activate - twine upload dist/* --verbose --config-file ~/.pypirc - -workflows: - version: 2 - build_and_deploy: - jobs: - - build: - filters: - tags: - only: /^v\d+(\.\d+)*(\.[0-9A-Za-z]*)*/ - branches: - ignore: /.*/ - - deploy_pypi: - requires: - - build - filters: - tags: - only: /^v\d+(\.\d+)*(\.[0-9A-Za-z]*)*/ - branches: - ignore: /.*/ - run_tests: - jobs: - - build diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml index f578e19a..f6238f21 100644 --- a/.github/workflows/deploy_release.yml +++ b/.github/workflows/deploy_release.yml @@ -1,54 +1,56 @@ name: Deploy release on: push: - tags: # run only on new tags that follow semver MAJOR.MINOR.PATCH - - '[0-9]+.[0-9]+.[0-9]+' + tags: + - '^v\d+(\.\d+)*(\.[0-9A-Za-z]*)*' jobs: + common-actions: + name: Run PR Workflow + uses: ./.github/workflows/github-actions-ci.yml + secrets: inherit + deploy-release: + needs: + - common-actions name: Deploy release from tag runs-on: ubuntu-latest steps: - - name: Checkout repo with submodules + - name: Checkout repo uses: actions/checkout@v4 with: - submodules: 'recursive' - fetch-depth: 0 # tags are required for versioneer to determine the version + fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.13' + # this should be the lowest supported version + python-version: '3.10' - name: Install build dependencies run: | - python -m pip install --upgrade pip - python -m pip install tox - python -m pip list - - - name: Run tox tests - run: | - tox -e py312-upgraded + pip install --upgrade pip + pip install hatch + pip list - name: Build wheel and source distribution run: | - tox -e build-py312-upgraded + hatch build ls -1 dist - - name: Test installation from a wheel - run: | - tox -e wheelinstall --recreate --installpkg dist/*-none-any.whl - - name: Upload wheel and source distributions to PyPI run: | pip install twine ls -1 dist - # twine upload --repository-url https://test.pypi.org/legacy/ -u ${{ secrets.BOT_PYPI_USER }} -p ${{ secrets.BOT_PYPI_PASSWORD }} --skip-existing dist/* - twine upload -u ${{ secrets.BOT_PYPI_USER }} -p ${{ secrets.BOT_PYPI_PASSWORD }} --skip-existing dist/* + # our current token does not work on testpypi + # twine upload -r testpypi -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing dist/* + twine upload -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing dist/* - - name: Publish wheel and source distributions as a GitHub release - run: | - python -m pip install "githubrelease>=1.5.9" - githubrelease --github-token ${{ secrets.BOT_GITHUB_TOKEN }} release NeurodataWithoutBorders/pynwb \ - create ${{ github.ref_name }} --name ${{ github.ref_name }} \ - --publish dist/* + - name: Keep packages + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: pypi-wheel-and-sdist + path: | + dist/* + if-no-files-found: error