Skip to content

Commit 35568ca

Browse files
Merge pull request #3 from mirumee/modernize-ci-release-tooling
build: modernize packaging metadata and CI/release workflows
2 parents 487799f + ae49b67 commit 35568ca

16 files changed

Lines changed: 551 additions & 221 deletions

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
env:
8+
PYTHONUNBUFFERED: "1"
9+
FORCE_COLOR: "1"
10+
11+
jobs:
12+
test:
13+
uses: ./.github/workflows/test.yml
14+
permissions:
15+
contents: read
16+
17+
build:
18+
name: Build distribution
19+
runs-on: ubuntu-latest
20+
needs:
21+
- test
22+
23+
steps:
24+
- name: Checkout source code
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python 3.10
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.10"
31+
32+
- name: Install Hatch
33+
run: pipx install hatch
34+
35+
- name: Set package version from tag
36+
run: hatch version "$(git describe --tags --always)"
37+
38+
- name: Build package
39+
run: hatch build
40+
41+
- name: Store the distribution packages
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: python-package-distributions
45+
path: dist/
46+
47+
sign-release:
48+
name: Sign Python distribution with Sigstore
49+
needs:
50+
- build
51+
runs-on: ubuntu-latest
52+
permissions:
53+
id-token: write
54+
55+
steps:
56+
- name: Download distribution artifacts
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: python-package-distributions
60+
path: dist/
61+
62+
- name: Sign distributions with Sigstore
63+
uses: sigstore/gh-action-sigstore-python@v3.0.0
64+
with:
65+
inputs: >-
66+
./dist/*.tar.gz
67+
./dist/*.whl
68+
69+
- name: Store signed distribution artifacts
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: python-package-distributions
73+
path: dist/
74+
overwrite: true

.github/workflows/code_quality.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Prepare release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
workflow_call:
8+
workflow_dispatch:
9+
10+
env:
11+
PYTHONUNBUFFERED: "1"
12+
FORCE_COLOR: "1"
13+
14+
jobs:
15+
build:
16+
uses: ./.github/workflows/build.yml
17+
permissions:
18+
contents: read
19+
id-token: write
20+
21+
create-release:
22+
needs:
23+
- build
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Generate release notes
35+
id: release-notes
36+
uses: orhun/git-cliff-action@v4
37+
with:
38+
config: cliff.toml
39+
args: --latest --strip all
40+
env:
41+
OUTPUT: RELEASE_NOTES.md
42+
GITHUB_REPO: ${{ github.repository }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Download distribution artifacts
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
- name: Create draft release
52+
id: create-draft-release
53+
uses: softprops/action-gh-release@v2
54+
with:
55+
files: |
56+
./dist/*
57+
draft: true
58+
body_path: RELEASE_NOTES.md
59+
60+
- name: Summary
61+
run: |
62+
echo "# Release summary" >> "$GITHUB_STEP_SUMMARY"
63+
echo "Url: ${{ steps.create-draft-release.outputs.url }}" >> "$GITHUB_STEP_SUMMARY"
64+
echo "You can now publish the release on GitHub" >> "$GITHUB_STEP_SUMMARY"

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_call:
8+
workflow_dispatch:
9+
10+
env:
11+
PYTHONUNBUFFERED: "1"
12+
FORCE_COLOR: "1"
13+
14+
jobs:
15+
publish-to-pypi:
16+
name: Publish Python distribution to PyPI
17+
if: startsWith(github.ref, 'refs/tags/')
18+
runs-on: ubuntu-latest
19+
environment:
20+
name: pypi
21+
url: https://pypi.org/p/ariadne-lambda
22+
permissions:
23+
id-token: write
24+
contents: read
25+
26+
steps:
27+
- name: Download all distributions from release
28+
env:
29+
GITHUB_TOKEN: ${{ github.token }}
30+
run: >-
31+
gh release download
32+
'${{ github.ref_name }}'
33+
-p '*.whl'
34+
-p '*.tar.gz'
35+
--dir dist/
36+
--repo '${{ github.repository }}'
37+
38+
- name: Publish package distributions to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
with:
41+
skip-existing: true

.github/workflows/run_tests.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
schedule:
9+
- cron: "0 7 * * 1,3"
10+
workflow_call:
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: ci-${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
PYTHONUNBUFFERED: "1"
19+
FORCE_COLOR: "1"
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
28+
29+
steps:
30+
- name: Checkout source code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Python ${{ matrix.python-version }}
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
38+
- name: Install Hatch
39+
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc
40+
41+
- name: Run static analysis
42+
run: hatch run lint
43+
44+
- name: Run tests
45+
run: hatch test -c -py ${{ matrix.python-version }}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# CHANGELOG
2+
3+
All notable unreleased changes to this project will be documented in this file.
4+
5+
For released versions, see the [Releases](https://github.com/mirumee/ariadne-lambda/releases) page.
6+
7+
## Unreleased
8+
9+
### 🛠️ Build System
10+
- Modernize packaging metadata and CI/release workflows
11+
12+

ariadne_lambda/__about__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.1.dev0" # This is overwritten by Hatch in CI/CD, don't change it.

ariadne_lambda/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class GraphQLLambdaHandler(GraphQLHandler):
1010
@abstractmethod
11-
async def handle(self, event: dict, context: LambdaContext):
11+
async def handle(self, event: dict, context: LambdaContext): # ty: ignore[invalid-method-override]
1212
"""An entrypoint for the AWS Lambda connection handler.
1313
1414
This method is called by Ariadne AWS Lambda GraphQL application. Subclasses

0 commit comments

Comments
 (0)