Skip to content

Commit 539490b

Browse files
working on release pipeline
1 parent 92535eb commit 539490b

File tree

6 files changed

+146
-29
lines changed

6 files changed

+146
-29
lines changed

.github/workflows/release-build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release Pipeline
2+
3+
4+
on:
5+
workflow_dispatch:
6+
workflow_call:
7+
#workflow_run:
8+
# workflows: ["Release Trigger"]
9+
# types: ["completed"]
10+
# branches:
11+
# - 'releases/**'
12+
# - 'main'
13+
# - 'carl/**' # FIXME: Remove. This is for testing/development.
14+
15+
env:
16+
PYTHON_VERSION: "3.13"
17+
18+
jobs:
19+
build-wheel:
20+
name: Build Wheel packages
21+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
- name: Prepare common Python build environment
27+
uses: ./.github/actions/python-common-setup
28+
with:
29+
python-version: ${{ env.PYTHON_VERSION }}
30+
- name: 'Nox: Build Wheel'x
31+
run: |
32+
nox -s build_wheel
33+
34+
build-docs:
35+
name: Build MKDocs Documentation
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
- name: Prepare common Python build environment
41+
uses: ./.github/actions/python-common-setup
42+
with:
43+
python-version: ${{ env.PYTHON_VERSION }}
44+
- name: 'Nox: Build MKDocs'
45+
run: |
46+
nox -s mkdocs_build
47+
48+
release-pypi:
49+
name: Release package to PyPi
50+
runs-on: ubuntu-latest
51+
needs: build-wheel
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
- name: Prepare common Python build environment
56+
uses: ./.github/actions/python-common-setup
57+
with:
58+
python-version: ${{ env.PYTHON_VERSION }}
59+
- name: 'Nox: Publish to PyPi'
60+
run: |
61+
nox -s release_pypi
62+
63+
release-readthedocs:
64+
name: Release documentation to readthedocs.com
65+
runs-on: ubuntu-latest
66+
needs: build-docs
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
- name: Prepare common Python build environment
71+
uses: ./.github/actions/python-common-setup
72+
with:
73+
python-version: ${{ env.PYTHON_VERSION }}
74+
- name: 'Nox: Publish to ReadTheDocs'
75+
run: |
76+
nox -s release_readthedocs

.github/workflows/release-publish.yml

Whitespace-only changes.

.github/workflows/release-trigger.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release Trigger
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
test_input:
7+
description: "Workflow test user input"
8+
type: string
9+
required: true
10+
default: "test input value"
11+
12+
env:
13+
PYTHON_VERSION: "3.13"
14+
15+
# TODO: Tag and branch
16+
17+
jobs:
18+
test:
19+
name: "Pre-relase Test"
20+
uses: ./github/workflows/test.yml
21+
package:
22+
name: "Package"
23+
uses: ./github/workflows/release-build.yml
24+
needs: test
25+
foo-1:
26+
name: "Foo 1"
27+
runs-on: ubuntu-latest
28+
needs: package
29+
steps:
30+
- run: /bin/true
31+
- run: /bin/true
32+
foo-2:
33+
name: "Foo 2"
34+
runs-on: ubuntu-latest
35+
needs: package
36+
steps:
37+
- run: /bin/false
38+
- run: /bin/false
39+
foo-3:
40+
name: "Foo 3"
41+
runs-on: ubuntu-latest
42+
needs: foo-2
43+
steps:
44+
- run: /bin/true
45+
- run: /bin/true
46+
# publish:
47+
# name: "Publish"
48+
# uses: ./github/workflows/release-publish.yml
49+
# needs: package

.github/workflows/release.yml

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

noxfile.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@nox.session(python=_ALL_PYTHON)
1313
def pytest(session):
14-
session.install("-e", ".[tests]")
14+
session.install("-e", ".[test]")
1515

1616
options = session.posargs
1717
if "-k" in options:
@@ -22,62 +22,62 @@ def pytest(session):
2222

2323
@nox.session(python=_DEFAULT_PYTHON)
2424
def semgrep_src(session):
25-
session.install("-e", ".[tests]")
25+
session.install("-e", ".[test]")
2626
# session.run("semgrep", "scan", "--strict", "--verbose", "--error", "--junit-xml", "--junit-xml-output=semgrep-src.xml", "src")
2727
session.run("semgrep", "scan", "--strict", "--verbose", "--error", "src")
2828

2929

3030
@nox.session(name="black-lint", python=_DEFAULT_PYTHON)
3131
def black_lint(session):
32-
session.install("-e", ".[tests]")
32+
session.install("-e", ".[test]")
3333
session.run("black", "--verbose", "--check", "--diff", "--color", ".")
3434

3535

3636
@nox.session(python=_DEFAULT_PYTHON)
3737
def black_format(session):
38-
session.install("-e", ".[tests]")
38+
session.install("-e", ".[test]")
3939
session.run("black", "--verbose", ".")
4040

4141

4242
@nox.session(python=_DEFAULT_PYTHON)
4343
def mypy(session):
44-
session.install("-e", ".[tests, examples]")
44+
session.install("-e", ".[test, examples]")
4545
session.run("mypy", "--install-type", "--non-interactive", "--junit-xml", "mypy.xml")
4646

4747

4848
@nox.session(python=_DEFAULT_PYTHON)
4949
def pyflakes_src(session):
50-
session.install("-e", ".[tests]")
50+
session.install("-e", ".[test]")
5151
session.run("pyflakes", "src")
5252

5353

5454
@nox.session(python=_DEFAULT_PYTHON)
5555
def pyflakes_examples(session):
56-
session.install("-e", ".[tests, examples]")
56+
session.install("-e", ".[test, examples]")
5757
session.run("pyflakes", "docs/examples")
5858

5959

6060
@nox.session(python=_DEFAULT_PYTHON)
6161
def pyflakes_tests(session):
62-
session.install("-e", ".[tests]")
62+
session.install("-e", ".[test]")
6363
session.run("pyflakes", "tests")
6464

6565

6666
@nox.session(python=_DEFAULT_PYTHON)
6767
def pylint_src(session):
68-
session.install("-e", ".[tests]")
68+
session.install("-e", ".[test]")
6969
session.run("pylint", "src")
7070

7171

7272
@nox.session(python=_DEFAULT_PYTHON)
7373
def pylint_examples(session):
74-
session.install("-e", ".[tests, examples]")
74+
session.install("-e", ".[test, examples]")
7575
session.run("pylint", "docs/examples")
7676

7777

7878
@nox.session(python=_DEFAULT_PYTHON)
7979
def pylint_tests(session):
80-
session.install("-e", ".[tests]")
80+
session.install("-e", ".[test]")
8181
session.run("pylint", "--disable", "protected-access", "--disable", "unused-variable", "tests")
8282

8383

@@ -108,14 +108,14 @@ def mkdocs_serve(session):
108108

109109

110110
@nox.session(python=_DEFAULT_PYTHON)
111-
def pyblish_pypi(session):
111+
def publish_pypi(session):
112112
session.install("-e", ".[build]")
113113
# TODO
114114
assert False
115115

116116

117117
@nox.session(python=_DEFAULT_PYTHON)
118-
def pyblish_readthedocs(session):
118+
def publish_readthedocs(session):
119119
session.install("-e", ".[build, docs]")
120120
# TODO
121121
assert False

pyproject.toml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
[project]
55
name = "planet-auth"
66
requires-python = ">=3.9"
7-
# FIXME tool.setuptools.dynamic doesn't seem to work with building wheels.
8-
# I end up with version 0.0.0 with no dependencies.
9-
# The dependencies I can live with since need to manage frozen and
10-
# unfrozen lists anyway. But, I really want to use the version.txt
11-
# and/or the generated version-with-buildnum.txt file.
12-
# dynamic = ["version", "dependencies", "optional-dependencies"]
13-
version = "2.0.0"
7+
dynamic = ["version"]
8+
# version = "X.X.X"
149
description = "Planet Auth Utility Code"
1510
readme = "README.md"
1611
authors = [{ name = "Carl Adams", email = "[email protected]" }]
@@ -52,7 +47,7 @@ examples = [
5247
"flask",
5348
# "planet-auth-config >= 2.0.0"
5449
]
55-
tests = [
50+
test = [
5651
"black",
5752
"coverage[toml]",
5853
"mypy",
@@ -66,6 +61,9 @@ tests = [
6661
"semgrep",
6762
"validators",
6863
]
64+
dev = [
65+
"planet-auth[test, docs, build]",
66+
]
6967
internal = [
7068
"planet-auth-config >= 2.0.0",
7169
]
@@ -77,8 +75,8 @@ plauth = "planet_auth_utils.commands.cli.main:plauth_cmd_group"
7775
requires = ["setuptools>=62.0.0", "wheel"]
7876
build-backend = "setuptools.build_meta"
7977

80-
#[tool.setuptools.dynamic]
81-
# version = {file = "version.txt"}
78+
[tool.setuptools.dynamic]
79+
version = {file = "version.txt"}
8280
# version = {file = "version-with-buildnum.txt"}
8381

8482
## ###########################################################################

0 commit comments

Comments
 (0)