Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testing #72

Merged
merged 12 commits into from
Jan 29, 2024
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 26 additions & 16 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,26 @@ 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
file: cg-django-uaa-repo/ci/pipeline.yml

- 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
# - 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:
Expand Down Expand Up @@ -72,15 +75,22 @@ 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
type: git
source:
uri: https://github.com/cloud-gov/cg-django-uaa.git
branch: update-django-4
# 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
Expand All @@ -90,12 +100,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
Expand Down
6 changes: 6 additions & 0 deletions ci/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions ci/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/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 .

# run tests
tox
# run tests in development mode
tox --develop
11 changes: 11 additions & 0 deletions ci/test-release.sh
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 12 additions & 0 deletions ci/test-release.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions docs/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -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
Expand Down
22 changes: 19 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading