From a144e3bb544949c3344dfa53af319cc11643653b Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 15:20:30 -0500 Subject: [PATCH 01/12] fix tox env names --- tox.ini | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 2a1a309..b8b59b6 100644 --- a/tox.ini +++ b/tox.ini @@ -2,12 +2,28 @@ envlist = py3{8,9,10,11,12}-django{40,41,42} isolated_build = true -[testenv:py3{8,9,10,11,12}] +[testenv:py3{8,9,10,11,12}-django40] deps = - -rrequirements-tests.txt - -rrequirements-dev.txt + -r requirements-tests.txt + -r requirements-dev.txt django40: Django>=4.0,<4.1 +commands = + python -m uaa_client.runtests -v + python -m mypy uaa_client -v + +[testenv:py3{8,9,10,11,12}-django41] +deps = + -r requirements-tests.txt + -r requirements-dev.txt django41: Django>=4.1,<4.2 +commands = + python -m uaa_client.runtests -v + python -m mypy uaa_client -v + +[testenv:py3{8,9,10,11,12}-django42] +deps = + -r requirements-tests.txt + -r requirements-dev.txt django42: Django>=4.2,<4.3 commands = python -m uaa_client.runtests -v From 446edcd208ea9410e17b48e3bfa3ebd525de5627 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 15:20:40 -0500 Subject: [PATCH 02/12] update test running script --- ci/run-tests.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ci/run-tests.sh b/ci/run-tests.sh index 7c93135..325bec1 100755 --- a/ci/run-tests.sh +++ b/ci/run-tests.sh @@ -1,10 +1,12 @@ #!/bin/bash python -m venv venv -source ./venv/bin/activate +source venv/bin/activate python -m pip install -r requirements-tests.txt -python -m pip install -e . + +# install package in development mode +# python -m pip install --editable . # run tests tox From 207969c07b1aff9afa6f2acbb00d2d284f6e9db5 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:21:38 -0500 Subject: [PATCH 03/12] update branch --- ci/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index af74b6e..68de4a8 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -78,7 +78,7 @@ resources: type: git source: uri: https://github.com/cloud-gov/cg-django-uaa.git - branch: update-django-4 + branch: fix-testing # only run on new tags matching pattern like: v0.1.5 # tag_regex: '^v([0-9]+\.){0,2}(\*|[0-9]+)$' commit_verification_keys: ((cloud-gov-pgp-keys)) From ee5ecf54b3af942d8861e41c2d0c5115acaa0ec0 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:48:36 -0500 Subject: [PATCH 04/12] make tox run in development mode for PR tests --- ci/run-tests.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ci/run-tests.sh b/ci/run-tests.sh index 325bec1..188d679 100755 --- a/ci/run-tests.sh +++ b/ci/run-tests.sh @@ -5,8 +5,5 @@ source venv/bin/activate python -m pip install -r requirements-tests.txt -# install package in development mode -# python -m pip install --editable . - -# run tests -tox +# run tests in development mode +tox --develop From d26b688ba47a5111d267a190fd57ba3e5ab0095e Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:49:11 -0500 Subject: [PATCH 05/12] update prepare-release script to build release --- ci/prepare-release.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci/prepare-release.sh b/ci/prepare-release.sh index f2c24e8..a06759c 100755 --- a/ci/prepare-release.sh +++ b/ci/prepare-release.sh @@ -2,3 +2,9 @@ TAG=$(git describe --tags) echo "$TAG" > tag + +# Install build module +python -m pip install build + +# Build release +python -m build --sdist From 890546c74c8347ffbf8e8140183cfb4e27a3866f Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:49:32 -0500 Subject: [PATCH 06/12] add test release step && re-enable step to create github release --- ci/pipeline.yml | 29 ++++++++++++++++------------- ci/test-release.sh | 11 +++++++++++ ci/test-release.yml | 12 ++++++++++++ 3 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 ci/test-release.sh create mode 100644 ci/test-release.yml diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 68de4a8..dab5d38 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -39,11 +39,15 @@ jobs: trigger: true - task: prepare-release file: cg-django-uaa-repo-tag/ci/prepare-release.yml - # - put: cg-django-uaa-release - # params: - # name: cg-django-uaa-repo-tag/tag - # tag: cg-django-uaa-repo-tag/tag - # generate_release_notes: true + - task: test-release + file: cg-django-uaa-repo-tag/ci/test-release.yml + - put: cg-django-uaa-release + params: + name: cg-django-uaa-repo-tag/tag + tag: cg-django-uaa-repo-tag/tag + generate_release_notes: true + globs: + - cg-django-uaa-repo-tag/dist/cg-django-uaa* on_failure: put: slack params: @@ -78,9 +82,8 @@ resources: type: git source: uri: https://github.com/cloud-gov/cg-django-uaa.git - branch: fix-testing # only run on new tags matching pattern like: v0.1.5 - # tag_regex: '^v([0-9]+\.){0,2}(\*|[0-9]+)$' + tag_regex: '^v([0-9]+\.){0,2}(\*|[0-9]+)$' commit_verification_keys: ((cloud-gov-pgp-keys)) # This resource for posting to slack @@ -90,12 +93,12 @@ resources: url: ((slack-webhook-url)) # Resource for creating a new release -# - name: cg-django-uaa-release -# type: github-release -# source: -# owner: cloud-gov -# repository: cg-django-uaa -# access_token: ((cg-ci-bot-ghtoken)) +- name: cg-django-uaa-release + type: github-release + source: + owner: cloud-gov + repository: cg-django-uaa + access_token: ((cg-ci-bot-ghtoken)) - name: general-task type: registry-image diff --git a/ci/test-release.sh b/ci/test-release.sh new file mode 100644 index 0000000..ce44972 --- /dev/null +++ b/ci/test-release.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +python -m venv venv +source venv/bin/activate + +TAG=$(git describe --tags) + +python -m pip install -r requirements-tests.txt + +# run tests on release +tox --installpkg "dist/cg-django-uaa-$TAG.tar.gz" diff --git a/ci/test-release.yml b/ci/test-release.yml new file mode 100644 index 0000000..6a06609 --- /dev/null +++ b/ci/test-release.yml @@ -0,0 +1,12 @@ +--- +platform: linux + +inputs: +- name: cg-django-uaa-repo-tag + +outputs: +- name: cg-django-uaa-repo-tag + +run: + dir: cg-django-uaa-repo-tag + path: ci/test-release.sh From ba1d6276d4af721bcae71c6d6f26215e0f55bc08 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:52:24 -0500 Subject: [PATCH 07/12] update dev docs --- docs/developing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/developing.rst b/docs/developing.rst index 2a45fdc..f367ea4 100644 --- a/docs/developing.rst +++ b/docs/developing.rst @@ -54,9 +54,9 @@ with:: tox -or against specific versions, for instance python 3.8 with django 3.1:: +or against specific versions, for instance Python 3.10 with Django 4.2:: - tox -e py38-django31 + tox -e py310-django42 Formatting code From 2224e4075b360392f68eefee5fc75087135699a6 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:52:38 -0500 Subject: [PATCH 08/12] update 18F -> cloud-gov in repo name --- RELEASE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 8e29598..9956055 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -58,5 +58,5 @@ Here's how to issue a new release: 1. Run `python -m twine upload dist/*`. The new release should now be visible on [pypi][]. -[GitHub releases page]: https://github.com/18F/cg-django-uaa/releases +[GitHub releases page]: https://github.com/cloud-gov/cg-django-uaa/releases [pypi]: https://pypi.python.org/pypi/cg-django-uaa From b3d515ef93f67afadbb2428c2a0f7156736fa5cf Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:55:53 -0500 Subject: [PATCH 09/12] update dev docs --- docs/developing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developing.rst b/docs/developing.rst index f367ea4..f16f0df 100644 --- a/docs/developing.rst +++ b/docs/developing.rst @@ -22,7 +22,7 @@ development dependencies:: Then install cg-django-uaa in development mode:: - python -m pip install -e . + python -m pip install --editable . Using the example app ~~~~~~~~~~~~~~~~~~~~~ From 2dd0062b7d37bb961cd5f5d06eaca7f8d55e1fa7 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:58:10 -0500 Subject: [PATCH 10/12] update pipeline set-self step to use branch as source --- ci/pipeline.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index dab5d38..239b55f 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -27,7 +27,7 @@ jobs: - name: set-self plan: - - get: cg-django-uaa-repo-tag + - get: cg-django-uaa-repo trigger: true - set_pipeline: self file: cg-django-uaa-repo-tag/ci/pipeline.yml @@ -35,7 +35,6 @@ jobs: - name: create-release plan: - get: cg-django-uaa-repo-tag - passed: [set-self] trigger: true - task: prepare-release file: cg-django-uaa-repo-tag/ci/prepare-release.yml @@ -76,6 +75,14 @@ resources: access_token: ((status-access-token)) disable_forks: true +# this resource is this repo +- name: cg-django-uaa-repo + type: git + source: + uri: https://github.com/cloud-gov/cg-django-uaa.git + branch: main + commit_verification_keys: ((cloud-gov-pgp-keys)) + # this resource is this repo # NOTE: we only execute on tag changes not commits, see tag_regex - name: cg-django-uaa-repo-tag From 5a5944084c3b90551f17629ca182ebd2073193d0 Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 16:58:55 -0500 Subject: [PATCH 11/12] update pipeline --- ci/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 239b55f..7f42ddb 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -30,7 +30,7 @@ jobs: - get: cg-django-uaa-repo trigger: true - set_pipeline: self - file: cg-django-uaa-repo-tag/ci/pipeline.yml + file: cg-django-uaa-repo/ci/pipeline.yml - name: create-release plan: From c95bb6c9dbb2ed9b0f52af164140a0d12c06eaac Mon Sep 17 00:00:00 2001 From: Mark Boyd Date: Mon, 29 Jan 2024 17:16:15 -0500 Subject: [PATCH 12/12] update RELEASE --- RELEASE.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 9956055..3d0dd99 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -41,6 +41,9 @@ Here's how to issue a new release: `CHANGELOG.md` for this, as whatever you enter will show up on the [GitHub releases page][]. +1. After you push, the [CI pipeline](./ci/pipeline.yml) will automatically + create a [GitHub release][GitHub releases page] for the tag. + 1. If you haven't already done so, create a `~/.pypirc` file with the following content: @@ -56,7 +59,7 @@ Here's how to issue a new release: ``` 1. Run `python -m twine upload dist/*`. The new release should now - be visible on [pypi][]. + be visible on [PyPI][]. [GitHub releases page]: https://github.com/cloud-gov/cg-django-uaa/releases -[pypi]: https://pypi.python.org/pypi/cg-django-uaa +[PyPI]: https://pypi.python.org/pypi/cg-django-uaa