Skip to content

Commit 30f859e

Browse files
authoredFeb 29, 2024··
feat(release): automate release via release-please (#429)
# changes - add `release-please` as the release automation tool - refactor "install python" into a reusable local action - build and test with Python `3.12` - seems it didn't take much extra effort # notes - previously, the actual "releases" here on GitHub was a mess - `3.7.1` is the latest on PyPI - only exists as a tag on this repo, no release notes - the latest "release" is put out later than some of the higher version tags - `.github/.release-please-manifest.json` -> went with the sha from `3.7.1` which then `release-please` will take as "latest live version", also made `3.7.1` in the manifest --------- Co-authored-by: Balint Bartha <totallyzen@users.noreply.github.com>
1 parent d912dfb commit 30f859e

14 files changed

+103
-112
lines changed
 

‎.github/.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "3.7.1"
3+
}

‎.github/actions/setup-env/action.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: setup-env
2+
description: set up the python environment
3+
4+
inputs:
5+
python-version:
6+
description: "The python version to install and use"
7+
default: "3.12" # we default to latest supported
8+
required: false
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Setup Poetry
14+
run: pipx install poetry
15+
shell: bash
16+
- name: Setup python ${{ inputs.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ inputs.python-version }}
20+
cache: poetry

‎.github/release-please-config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"release-type": "python",
3+
"bootstrap-sha": "28e3a471c32c1036dd5e37df13cdde3b1ba91000",
4+
"packages": {
5+
".": {
6+
"package-name": "testcontainers"
7+
}
8+
},
9+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
10+
}

‎.github/workflows/attention-label.yml.disabled

-30
This file was deleted.

‎.github/workflows/ci-community.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,10 @@ jobs:
6161
gh run watch ${{ github.run_id }}
6262
env:
6363
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64-
- name: Setup Poetry
65-
run: pipx install poetry
66-
- name: Setup python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v4
64+
- name: Set up Python
65+
uses: ./.github/actions/setup-env
6866
with:
6967
python-version: ${{ matrix.python-version }}
70-
cache: poetry
7168
- name: Install Python dependencies
7269
run: poetry install -E ${{ matrix.module }}
7370
- name: Run tests

‎.github/workflows/ci-core.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ on:
1111
jobs:
1212
test:
1313
strategy:
14+
fail-fast: false
1415
matrix:
1516
os: [ ubuntu ]
16-
python-version: ["3.9", "3.10", "3.11"]
17+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1718
runs-on: ${{ matrix.os }}-latest
1819
steps:
1920
- uses: actions/checkout@v4
20-
- name: Setup Poetry
21-
run: pipx install poetry
22-
- name: Setup python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v5
21+
- name: Set up Python
22+
uses: ./.github/actions/setup-env
2423
with:
2524
python-version: ${{ matrix.python-version }}
26-
cache: poetry
2725
- name: Install Python dependencies
2826
run: poetry install --all-extras
2927
- name: Run twine check

‎.github/workflows/ci-lint.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@ on:
99
branches: [main]
1010

1111
jobs:
12-
all:
12+
python:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- name: Setup Poetry
17-
run: pipx install poetry
18-
- name: Setup python 3.9
19-
uses: actions/setup-python@v5
16+
- name: Setup Env
17+
uses: ./.github/actions/setup-env
2018
with:
21-
python-version: 3.9
22-
cache: poetry
19+
python-version: "3.9" # the pre-commit is hooked in as 3.9
2320
- name: Install Python dependencies
2421
run: poetry install
2522
- name: Install pre-commit

‎.github/workflows/docs.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
14-
- name: Setup Poetry
15-
run: pipx install poetry
16-
- name: Setup python
17-
uses: actions/setup-python@v5
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: ./.github/actions/setup-env
1816
with:
1917
python-version: "3.11"
20-
cache: poetry
2118
- name: Install Python dependencies
2219
run: poetry install --all-extras
2320
- name: Build documentation

‎.github/workflows/pr-lint.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: lint-pr
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
validate:
15+
name: validate-pull-request-title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: validate pull request title
19+
uses: kontrolplane/pull-request-title-validator@ab2b54babb5337246f4b55cf8e0a1ecb0575e46d #v1

‎.github/workflows/release-please.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
release_created: ${{ steps.track-release.outputs.release_created }}
12+
steps:
13+
- uses: google-github-actions/release-please-action@v4
14+
id: track-release
15+
with:
16+
manifest-file: .github/.release-please-manifest.json
17+
config-file: .github/release-please-config.json
18+
publish:
19+
runs-on: ubuntu-latest
20+
environment: release
21+
permissions:
22+
id-token: write
23+
needs:
24+
- release
25+
if: ${{ needs.release.outputs.release_created }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Python
29+
uses: ./.github/actions/setup-env
30+
- name: build package
31+
run: poetry build
32+
# this action uploads packages from the `dist/` directory, which poetry has built in the previous step
33+
# usable once we set up trusted publishing, see https://docs.pypi.org/trusted-publishers/using-a-publisher/
34+
- name: push package
35+
uses: pypa/gh-action-pypi-publish@release/v1

‎.github/workflows/requirements.yml.disabled

-43
This file was deleted.

‎.github/workflows/triage-label.yml.disabled

-12
This file was deleted.

‎poetry.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ packages = [
5656
"Issue Tracker" = "https://github.com/testcontainers/testcontainers-python/issues"
5757

5858
[tool.poetry.dependencies]
59-
python = ">=3.9,<3.12"
59+
python = ">=3.9,<4.0"
6060
docker = "*" # ">=4.0"
6161
urllib3 = "*" # "<2.0"
6262
wrapt = "*" # "^1.16.0"

0 commit comments

Comments
 (0)
Please sign in to comment.