From 622d7e7ce63fcb1c452d2f393198fcd7b7f5d3fc Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 14:24:20 +0100 Subject: [PATCH 1/9] feat(release): automate release via release-please --- .github/.release-please-manifest.json | 3 ++ .github/actions/setup-env/action.yml | 26 +++++++++++ .github/release-please-config.json | 9 ++++ .../workflows/attention-label.yml.disabled | 30 ------------- .github/workflows/ci-community.yml | 8 ++-- .github/workflows/ci-core.yml | 8 +--- .github/workflows/ci-lint.yml | 10 +---- .github/workflows/docs.yml | 8 +--- .github/workflows/pr-lint.yml | 19 ++++++++ .github/workflows/release-please.yml | 15 +++++++ .github/workflows/requirements.yml.disabled | 43 ------------------- .github/workflows/triage-label.yml.disabled | 12 ------ 12 files changed, 81 insertions(+), 110 deletions(-) create mode 100644 .github/.release-please-manifest.json create mode 100644 .github/actions/setup-env/action.yml create mode 100644 .github/release-please-config.json delete mode 100644 .github/workflows/attention-label.yml.disabled create mode 100644 .github/workflows/pr-lint.yml create mode 100644 .github/workflows/release-please.yml delete mode 100644 .github/workflows/requirements.yml.disabled delete mode 100644 .github/workflows/triage-label.yml.disabled diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json new file mode 100644 index 00000000..698886db --- /dev/null +++ b/.github/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "3.7.1" +} diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml new file mode 100644 index 00000000..1122907b --- /dev/null +++ b/.github/actions/setup-env/action.yml @@ -0,0 +1,26 @@ +name: setup-env +description: set up the python environment + +inputs: + python-version: + description: "The python version to install and use" + default: "3.9" # we default to the minimum python version for the project + required: false + auto-checkout: + description: "To perform the checkout or not. Might have done the checkout earlier" + default: "true" + required: false + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + if: ${{ inputs.auto-checkout == "true" }} + - name: Setup Poetry + run: pipx install poetry + shell: bash + - name: Setup python ${{ inputs.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + cache: poetry diff --git a/.github/release-please-config.json b/.github/release-please-config.json new file mode 100644 index 00000000..e6fe017d --- /dev/null +++ b/.github/release-please-config.json @@ -0,0 +1,9 @@ +{ + "release-type": "python", + "packages": { + ".": { + "package-name": "testcontainers" + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/.github/workflows/attention-label.yml.disabled b/.github/workflows/attention-label.yml.disabled deleted file mode 100644 index 97d38444..00000000 --- a/.github/workflows/attention-label.yml.disabled +++ /dev/null @@ -1,30 +0,0 @@ -name: Automatically add or remove labels -on: - issue_comment: - types: - - created -jobs: - show-metadata: - runs-on: ubuntu-latest - steps: - # Use environment variable to print the metadata (cf. https://github.com/actions/runner/issues/1656#issuecomment-1030077729). - - name: Show metadata - run: echo $JSON - env: - JSON: ${{ toJson(github.event) }} - add-label: - if: ${{ github.event.comment.user.login != 'tillahoffmann' }} - runs-on: ubuntu-latest - steps: - - name: Add label - uses: actions-ecosystem/action-add-labels@v1 - with: - labels: '👀 requires attention' - remove-label: - if: ${{ github.event.comment.user.login == 'tillahoffmann' }} - runs-on: ubuntu-latest - steps: - - name: Remove label - uses: actions-ecosystem/action-remove-labels@v1 - with: - labels: '👀 requires attention' diff --git a/.github/workflows/ci-community.yml b/.github/workflows/ci-community.yml index 92e58e51..1bd53a7c 100644 --- a/.github/workflows/ci-community.yml +++ b/.github/workflows/ci-community.yml @@ -61,13 +61,11 @@ jobs: gh run watch ${{ github.run_id }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Setup Poetry - run: pipx install poetry - - name: Setup python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Set up Python + uses: .github/actions/setup-env with: + auto-checkout: false python-version: ${{ matrix.python-version }} - cache: poetry - name: Install Python dependencies run: poetry install -E ${{ matrix.module }} - name: Run tests diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index c9661986..86855127 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -16,14 +16,10 @@ jobs: python-version: ["3.9", "3.10", "3.11"] runs-on: ${{ matrix.os }}-latest steps: - - uses: actions/checkout@v4 - - name: Setup Poetry - run: pipx install poetry - - name: Setup python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Set up Python + uses: .github/actions/setup-env with: python-version: ${{ matrix.python-version }} - cache: poetry - name: Install Python dependencies run: poetry install --all-extras - name: Run twine check diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 6261002b..349a8864 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -12,14 +12,8 @@ jobs: all: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Setup Poetry - run: pipx install poetry - - name: Setup python 3.9 - uses: actions/setup-python@v5 - with: - python-version: 3.9 - cache: poetry + - name: Setup Env + uses: .github/actions/setup-env - name: Install Python dependencies run: poetry install - name: Install pre-commit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 75f71e21..9d99a5ef 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,14 +10,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Setup Poetry - run: pipx install poetry - - name: Setup python - uses: actions/setup-python@v5 + - name: Set up Python + uses: .github/actions/setup-env with: python-version: "3.11" - cache: poetry - name: Install Python dependencies run: poetry install --all-extras - name: Build documentation diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 00000000..b99c3074 --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,19 @@ +name: lint-pr + +on: + pull_request: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + validate: + name: validate-pull-request-title + runs-on: ubuntu-latest + steps: + - name: validate pull request title + uses: kontrolplane/pull-request-title-validator@ab2b54babb5337246f4b55cf8e0a1ecb0575e46d #v1 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..213b65c8 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,15 @@ +name: Release Please + +on: + push: + branches: [ main ] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + id: track-release + with: + manifest-file: .github/.release-please-manifest.json + config-file: .github/release-please-config.json diff --git a/.github/workflows/requirements.yml.disabled b/.github/workflows/requirements.yml.disabled deleted file mode 100644 index 72c41f30..00000000 --- a/.github/workflows/requirements.yml.disabled +++ /dev/null @@ -1,43 +0,0 @@ -name: testcontainers requirements -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - requirements: - strategy: - fail-fast: false - matrix: - runtime: - - machine: ubuntu-latest - python-version: "3.7" - - machine: ubuntu-latest - python-version: "3.8" - - machine: ubuntu-latest - python-version: "3.9" - - machine: ubuntu-latest - python-version: "3.10" - - machine: ubuntu-latest - python-version: "3.11" - - machine: windows-latest - python-version: "3.10" - - machine: macos-latest - python-version: "3.10" - runs-on: ${{ matrix.runtime.machine }} - steps: - - uses: actions/checkout@v3 - - name: Setup python ${{ matrix.runtime.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.runtime.python-version }} - - name: Update pip and install pip-tools - run: pip install --upgrade pip pip-tools - - name: Build requirements - run: pip-compile --resolver=backtracking -v --upgrade -o requirements.txt - - name: Store requirements as artifact - uses: actions/upload-artifact@v3 - with: - name: requirements-${{ matrix.runtime.machine }}-${{ matrix.runtime.python-version }}.txt - path: requirements.txt diff --git a/.github/workflows/triage-label.yml.disabled b/.github/workflows/triage-label.yml.disabled deleted file mode 100644 index a5ecf38a..00000000 --- a/.github/workflows/triage-label.yml.disabled +++ /dev/null @@ -1,12 +0,0 @@ -on: - issues: - types: - - opened -jobs: - add-label: - runs-on: ubuntu-latest - steps: - - name: Add label - uses: actions-ecosystem/action-add-labels@v1 - with: - labels: '🔀 requires triage' From 2d96684f8683f32482b5b12354b0fad78539bd8a Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 14:31:09 +0100 Subject: [PATCH 2/9] test: core packages did not run on previous commit --- .github/workflows/ci-community.yml | 2 +- .github/workflows/ci-core.yml | 2 +- .github/workflows/ci-lint.yml | 2 +- .github/workflows/docs.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-community.yml b/.github/workflows/ci-community.yml index 1bd53a7c..96298bf1 100644 --- a/.github/workflows/ci-community.yml +++ b/.github/workflows/ci-community.yml @@ -62,7 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Set up Python - uses: .github/actions/setup-env + uses: ./.github/actions/setup-env with: auto-checkout: false python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 86855127..bb32bdf5 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -17,7 +17,7 @@ jobs: runs-on: ${{ matrix.os }}-latest steps: - name: Set up Python - uses: .github/actions/setup-env + uses: ./.github/actions/setup-env with: python-version: ${{ matrix.python-version }} - name: Install Python dependencies diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 349a8864..55574c78 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Env - uses: .github/actions/setup-env + uses: ./.github/actions/setup-env - name: Install Python dependencies run: poetry install - name: Install pre-commit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9d99a5ef..c05f291c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Python - uses: .github/actions/setup-env + uses: ./.github/actions/setup-env with: python-version: "3.11" - name: Install Python dependencies From 2a75146be58c184ffcc8815f31036a7c55fd51a4 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 14:35:29 +0100 Subject: [PATCH 3/9] fix: need checkout before we can use local action --- .github/actions/setup-env/action.yml | 8 +------- .github/workflows/ci-community.yml | 1 - .github/workflows/ci-core.yml | 2 ++ .github/workflows/ci-lint.yml | 3 ++- .github/workflows/docs.yml | 1 + 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml index 1122907b..3c4d7b97 100644 --- a/.github/actions/setup-env/action.yml +++ b/.github/actions/setup-env/action.yml @@ -4,18 +4,12 @@ description: set up the python environment inputs: python-version: description: "The python version to install and use" - default: "3.9" # we default to the minimum python version for the project - required: false - auto-checkout: - description: "To perform the checkout or not. Might have done the checkout earlier" - default: "true" + default: "3.11" # we default to latest supported required: false runs: using: composite steps: - - uses: actions/checkout@v4 - if: ${{ inputs.auto-checkout == "true" }} - name: Setup Poetry run: pipx install poetry shell: bash diff --git a/.github/workflows/ci-community.yml b/.github/workflows/ci-community.yml index 96298bf1..b5b1c65f 100644 --- a/.github/workflows/ci-community.yml +++ b/.github/workflows/ci-community.yml @@ -64,7 +64,6 @@ jobs: - name: Set up Python uses: ./.github/actions/setup-env with: - auto-checkout: false python-version: ${{ matrix.python-version }} - name: Install Python dependencies run: poetry install -E ${{ matrix.module }} diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index bb32bdf5..a4952ee6 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -11,11 +11,13 @@ on: jobs: test: strategy: + fail-fast: false matrix: os: [ ubuntu ] python-version: ["3.9", "3.10", "3.11"] runs-on: ${{ matrix.os }}-latest steps: + - uses: actions/checkout@v4 - name: Set up Python uses: ./.github/actions/setup-env with: diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 55574c78..78e643b2 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -9,9 +9,10 @@ on: branches: [main] jobs: - all: + python: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - name: Setup Env uses: ./.github/actions/setup-env - name: Install Python dependencies diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c05f291c..1dfb6c71 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,6 +10,7 @@ jobs: build: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - name: Set up Python uses: ./.github/actions/setup-env with: From ed99e72d4fb08e969e63a07648d16e405ce7b866 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 14:38:35 +0100 Subject: [PATCH 4/9] fix: pre-commit needs 3.9 for the moment --- .github/workflows/ci-lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml index 78e643b2..0a9f4e26 100644 --- a/.github/workflows/ci-lint.yml +++ b/.github/workflows/ci-lint.yml @@ -15,6 +15,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Env uses: ./.github/actions/setup-env + with: + python-version: "3.9" # the pre-commit is hooked in as 3.9 - name: Install Python dependencies run: poetry install - name: Install pre-commit From 720e3633ef21343543de657308a7426e464285e3 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 14:46:54 +0100 Subject: [PATCH 5/9] chore(release): set bootstrap sha to the 3.7.1 tag --- .github/release-please-config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/release-please-config.json b/.github/release-please-config.json index e6fe017d..1bd96f93 100644 --- a/.github/release-please-config.json +++ b/.github/release-please-config.json @@ -1,5 +1,6 @@ { "release-type": "python", + "bootstrap-sha": "28e3a471c32c1036dd5e37df13cdde3b1ba91000", "packages": { ".": { "package-name": "testcontainers" From 3c71ca134839aa40b9d4f411011270b2c82d8749 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 17:14:25 +0100 Subject: [PATCH 6/9] feat(publish): add steps for publishing the package --- .github/workflows/release-please.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 213b65c8..b0e92119 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -7,9 +7,29 @@ on: jobs: release: runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.track-release.outputs.release_created }} steps: - uses: google-github-actions/release-please-action@v4 id: track-release with: manifest-file: .github/.release-please-manifest.json config-file: .github/release-please-config.json + publish: + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + needs: + - release + if: ${{ needs.release.outputs.release_created }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: ./.github/actions/setup-env + - name: build package + run: poetry build + # this action uploads packages from the `dist/` directory + # usable once we set up trusted publishing, see https://docs.pypi.org/trusted-publishers/using-a-publisher/ + - name: push package + uses: pypa/gh-action-pypi-publish@release/v1 From 1b8c77b2bbc2ce284fe7f2ff38ec91109dfdea32 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Tue, 27 Feb 2024 17:30:39 +0100 Subject: [PATCH 7/9] chore: better comments on releasing --- .github/workflows/release-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index b0e92119..a5a9821a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -29,7 +29,7 @@ jobs: uses: ./.github/actions/setup-env - name: build package run: poetry build - # this action uploads packages from the `dist/` directory + # this action uploads packages from the `dist/` directory, which poetry has built in the previous step # usable once we set up trusted publishing, see https://docs.pypi.org/trusted-publishers/using-a-publisher/ - name: push package uses: pypa/gh-action-pypi-publish@release/v1 From a342b60a45d2421d8ff437216d6ca638502a5f94 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Wed, 28 Feb 2024 18:11:46 +0100 Subject: [PATCH 8/9] fix(build): test the package with 3.12 --- .github/workflows/ci-core.yml | 2 +- poetry.lock | 4 ++-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index a4952ee6..65bb2388 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu ] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v4 diff --git a/poetry.lock b/poetry.lock index 41eda34b..5cf56c8c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3003,5 +3003,5 @@ selenium = ["selenium"] [metadata] lock-version = "2.0" -python-versions = ">=3.9,<3.12" -content-hash = "89891a5aeea49686e42fd95780d6aa703a1a13d8483a1a965aa32603b39f3a3d" +python-versions = ">=3.9,<4.0" +content-hash = "0316bbdbb2824f6086c32cb9ed00a23507896bf48494a38d086e281faf1f8189" diff --git a/pyproject.toml b/pyproject.toml index b825d8eb..2059926c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,7 @@ packages = [ "Issue Tracker" = "https://github.com/testcontainers/testcontainers-python/issues" [tool.poetry.dependencies] -python = ">=3.9,<3.12" +python = ">=3.9,<4.0" docker = "*" # ">=4.0" urllib3 = "*" # "<2.0" wrapt = "*" # "^1.16.0" From f5a7a2931436f21835f5b91b393092199451be28 Mon Sep 17 00:00:00 2001 From: Balint Bartha Date: Wed, 28 Feb 2024 18:17:19 +0100 Subject: [PATCH 9/9] fix(build): default build items to 3.12 --- .github/actions/setup-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml index 3c4d7b97..de870006 100644 --- a/.github/actions/setup-env/action.yml +++ b/.github/actions/setup-env/action.yml @@ -4,7 +4,7 @@ description: set up the python environment inputs: python-version: description: "The python version to install and use" - default: "3.11" # we default to latest supported + default: "3.12" # we default to latest supported required: false runs: