Skip to content

Commit 4a36d9f

Browse files
authored
build: Convert to poetry and release-please (#17)
1 parent b5dca2e commit 4a36d9f

31 files changed

+410
-265
lines changed

.circleci/config.yml

Lines changed: 0 additions & 105 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Build Documentation
2+
description: 'Build Documentation.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Build Documentation
8+
shell: bash
9+
run: make docs

.github/actions/build/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Build distribution files
2+
description: 'Build distribution files'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Build distribution files
8+
shell: bash
9+
run: poetry build
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Publish Documentation
2+
description: 'Publish the documentation to GitHub Pages'
3+
inputs:
4+
token:
5+
description: 'Token to use for publishing.'
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1
12+
name: 'Publish to Github pages'
13+
with:
14+
docs_path: docs/build/html/
15+
github_token: ${{inputs.token}} # For the shared action the token should be a GITHUB_TOKEN<

.github/actions/publish/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Package
2+
description: 'Publish the package to PyPI'
3+
inputs:
4+
token:
5+
description: 'Token to use for publishing.'
6+
required: true
7+
dry_run:
8+
description: 'Is this a dry run. If so no package will be published.'
9+
required: true
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Publish package distributions to PyPI
15+
uses: pypa/gh-action-pypi-publish@release/v1
16+
if: ${{ inputs.dry_run == 'false' }}
17+
with:
18+
password: ${{inputs.token}}

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Quality control checks
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- '**.md' # Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [ main ]
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
linux:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install poetry
29+
run: pipx install poetry
30+
31+
- uses: ./.github/actions/build
32+
- uses: ./.github/actions/build-docs
33+
34+
- name: Run tests
35+
run: make test
36+
37+
- name: Verify typehints
38+
run: make lint
39+
40+
- name: install contract test dependencies
41+
run: make install-contract-tests-deps
42+
43+
- name: start SSE contract test service
44+
run: make start-contract-test-service-bg
45+
46+
- name: run SSE contract tests
47+
run: make run-contract-tests
48+
49+
windows:
50+
runs-on: windows-latest
51+
52+
defaults:
53+
run:
54+
shell: powershell
55+
56+
strategy:
57+
matrix:
58+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Set up Python ${{ matrix.python-version }}
63+
uses: actions/setup-python@v4
64+
with:
65+
python-version: ${{ matrix.python-version }}
66+
67+
- name: Install requirements
68+
run: |
69+
pipx install poetry
70+
poetry install
71+
72+
- uses: ./.github/actions/build
73+
- uses: ./.github/actions/build-docs
74+
75+
- name: Run tests
76+
run: make test
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Lint PR title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
lint-pr-title:
12+
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
workflow_dispatch:
3+
4+
name: Publish Documentation
5+
jobs:
6+
build-publish-docs:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
id-token: write # Needed if using OIDC to get release secrets.
10+
contents: write # Needed in this case to write github pages.
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.7
17+
18+
- name: Install poetry
19+
run: pipx install poetry
20+
21+
- uses: ./.github/actions/build-docs
22+
23+
- uses: ./.github/actions/publish-docs
24+
with:
25+
token: ${{secrets.GITHUB_TOKEN}}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Package
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
dry_run:
6+
description: 'Is this a dry run. If so no package will be published.'
7+
type: boolean
8+
required: true
9+
10+
jobs:
11+
build-publish:
12+
runs-on: ubuntu-latest
13+
# Needed to get tokens during publishing.
14+
permissions:
15+
id-token: write
16+
contents: read
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.7
23+
24+
- name: Install poetry
25+
run: pipx install poetry
26+
27+
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0
28+
name: 'Get PyPI token'
29+
with:
30+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
31+
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
32+
33+
- uses: ./.github/actions/build
34+
35+
- uses: ./.github/actions/publish
36+
with:
37+
token: ${{env.PYPI_AUTH_TOKEN}}
38+
dry_run: ${{ inputs.dry_run }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Run Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-package:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # Needed if using OIDC to get release secrets.
13+
contents: write # Contents and pull-requests are for release-please to make releases.
14+
pull-requests: write
15+
steps:
16+
- uses: google-github-actions/release-please-action@v3
17+
id: release
18+
with:
19+
command: manifest
20+
token: ${{secrets.GITHUB_TOKEN}}
21+
default-branch: main
22+
23+
- uses: actions/checkout@v4
24+
if: ${{ steps.release.outputs.releases_created }}
25+
with:
26+
fetch-depth: 0 # If you only need the current version keep this.
27+
28+
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.0
29+
name: 'Get PyPI token'
30+
if: ${{ steps.release.outputs.releases_created }}
31+
with:
32+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
33+
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
34+
35+
- uses: ./.github/actions/build
36+
if: ${{ steps.release.outputs.releases_created }}
37+
38+
- uses: ./.github/actions/build-docs
39+
if: ${{ steps.release.outputs.releases_created }}
40+
41+
- uses: ./.github/actions/publish
42+
if: ${{ steps.release.outputs.releases_created }}
43+
with:
44+
token: ${{env.PYPI_AUTH_TOKEN}}
45+
dry_run: false
46+
47+
- uses: ./.github/actions/publish-docs
48+
if: ${{ steps.release.outputs.releases_created }}
49+
with:
50+
token: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)