Skip to content

Commit 924173f

Browse files
author
Thomas Thorogood
authored
Merge pull request #20 from UWIT-IAM/github-actions
Github Actions / Poetry integration
2 parents 5b931f0 + b174a42 commit 924173f

22 files changed

+1194
-237
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* jdiverp, tomthorogood

.github/workflows/pull-request.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on:
2+
pull_request:
3+
types:
4+
- labeled
5+
- synchronize
6+
7+
jobs:
8+
run-tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: uwit-iam/actions/require-semver-guidance-label@0.1.8
13+
with:
14+
github-token: ${{ github.token }}
15+
id: guidance
16+
- run: ./scripts/pre-push.sh --check-only

.travis.yml

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

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ghcr.io/uwit-iam/uw-saml-poetry:latest AS dependency-image
2+
WORKDIR build/
3+
RUN pip uninstall -y uw-saml
4+
COPY poetry.lock pyproject.toml ./
5+
RUN poetry install --no-interaction --no-root
6+
7+
FROM dependency-image AS test-image
8+
COPY uw_saml2 ./uw_saml2
9+
COPY tests/ ./tests
10+
RUN poetry install --no-interaction

MANIFEST.in

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

README.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# uw-saml
22

3-
[![Build Status](https://travis-ci.org/UWIT-IAM/uw-saml-python.svg?branch=master)](https://travis-ci.org/UWIT-IAM/uw-saml-python)
4-
[![Coverage Status](https://coveralls.io/repos/github/UWIT-IAM/uw-saml-python/badge.svg?branch=master)](https://coveralls.io/github/UWIT-IAM/uw-saml-python?branch=master)
5-
63
A UW-specific adapter to the
74
[python3-saml](https://github.com/onelogin/python3-saml) package. This package
85
was built to federate with other IdPs, but the default case is to use the UW
@@ -22,6 +19,18 @@ library. Therefore, it's an optional requirement, causing a runtime error
2219
instead of an install-time error. Alternatively, you can use a mock
2320
interface by setting `uw_saml2.python3_saml.MOCK = True`.
2421

22+
If you are able to run your app as a Docker container, you can base your image on
23+
[ghcr.io/uwit-iam/uw-saml-poetry:latest](https://ghcr.io/uwit-iam/uw-saml-poetry:latest)
24+
which comes with all dependencies pre-installed. Here is an example. Note that you
25+
don't have to use poetry in your install process to use this image.
26+
27+
```
28+
FROM ghcr.io/uwit-iam/uw-saml-poetry:latest AS dependencies
29+
RUN pip install flask uw-saml # uw-saml and python3-saml are already installed!
30+
COPY app.py ./
31+
CMD flask run app
32+
```
33+
2534
## Example login endpoint using flask
2635

2736
In this example you've gone to
@@ -35,6 +44,8 @@ Response.
3544
from flask import request, session, redirect
3645
import uw_saml2
3746

47+
app = Flask(__name__)
48+
3849
@app.route('/saml/login', methods=['GET', 'POST'])
3950
def login():
4051
session.clear()
@@ -88,3 +99,44 @@ uw_saml2.auth.CACHE = werkzeug.contrib.cache.RedisCache()
8899
```
89100

90101
Django's cache backend uses the same methods so that could be injected as well.
102+
103+
# Developers
104+
105+
## Maintenance
106+
107+
People who are developing this package should have either [poetry] or a docker daemon
108+
installed. This is so that you can run validations before pushing your code.
109+
110+
### Using docker (recommended)
111+
112+
This is recommended because this is the script the CI pipeline uses,
113+
so if this works for you, it ought to work in the pipeline, too!
114+
115+
```
116+
./scripts/pre-push.sh
117+
```
118+
119+
### Using poetry
120+
121+
Running directly is helpful when you want to attach debuggers, etc.
122+
123+
```
124+
poetry install
125+
poetry run pytest
126+
poetry run black uw_saml2 tests
127+
```
128+
129+
130+
## Pull Requests
131+
132+
When creating a pull request for this repository, a `semver-guidance` label must be
133+
applied to the PR. If you do not have write access, a reviewer must do this for
134+
you.
135+
136+
Use the following guidelines to select a version level for your change:
137+
138+
- `no-bump` if the change is only for documentation, CI workflow, etc.
139+
- `patch` if the change is a simple update or bugfix (e.g., idp metadata update,
140+
certificate renewal, etc.), or if dependencies are updated (`poetry.lock` changes)
141+
- `minor` if new features are added or deprecated but the change is backwards-compatible
142+
- `major` if the change is not backwards compatible and will break consumers

0 commit comments

Comments
 (0)