Skip to content

Commit

Permalink
feat(release): automate release via release-please (#429)
Browse files Browse the repository at this point in the history
# 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 <[email protected]>
  • Loading branch information
totallyzen and totallyzen authored Feb 29, 2024
1 parent d912dfb commit 30f859e
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 112 deletions.
3 changes: 3 additions & 0 deletions .github/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "3.7.1"
}
20 changes: 20 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: setup-env
description: set up the python environment

inputs:
python-version:
description: "The python version to install and use"
default: "3.12" # we default to latest supported
required: false

runs:
using: composite
steps:
- 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
10 changes: 10 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"release-type": "python",
"bootstrap-sha": "28e3a471c32c1036dd5e37df13cdde3b1ba91000",
"packages": {
".": {
"package-name": "testcontainers"
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
30 changes: 0 additions & 30 deletions .github/workflows/attention-label.yml.disabled

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/ci-community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,10 @@ 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:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install Python dependencies
run: poetry install -E ${{ matrix.module }}
- name: Run tests
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ on:
jobs:
test:
strategy:
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
- 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
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ on:
branches: [main]

jobs:
all:
python:
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
- name: Setup Env
uses: ./.github/actions/setup-env
with:
python-version: 3.9
cache: poetry
python-version: "3.9" # the pre-commit is hooked in as 3.9
- name: Install Python dependencies
run: poetry install
- name: Install pre-commit
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ 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
- uses: actions/checkout@v4
- 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
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release Please

on:
push:
branches: [ main ]

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, 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
43 changes: 0 additions & 43 deletions .github/workflows/requirements.yml.disabled

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/triage-label.yml.disabled

This file was deleted.

4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 30f859e

Please sign in to comment.