Skip to content

Commit f20a055

Browse files
authored
Merge pull request #175 from lumapps/MP-685/application-auth
Mp 685/application auth
2 parents 05494c0 + 0382ae6 commit f20a055

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+364
-159
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ jobs:
1212

1313
steps:
1414
- name: Checkout branch
15-
uses: actions/checkout@v2.3.4
15+
uses: actions/checkout@v2
1616

17-
- name: Setup Python 3.6 🐍
18-
uses: actions/setup-python@v2.1.4
17+
- name: Setup Python 🐍
18+
uses: actions/setup-python@v2
1919
with:
20-
python-version: 3.6
20+
python-version: 3.7
2121

2222
- name: Install Poetry
23-
uses: snok/[email protected]
23+
uses: snok/install-poetry@5e4414407e59f94f2148bcb253917dfc22dee7d9
24+
with:
25+
virtualenvs-in-project: false
26+
virtualenvs-path: ~/.cache/poetry/virtualenvs
2427

2528
- uses: actions/cache@v1
2629
name: Cache Poetry deps
@@ -30,38 +33,36 @@ jobs:
3033
restore-keys: |
3134
lint-${{ runner.os }}-poetry-
3235
33-
- name: Set Poetry config
34-
run: |
35-
poetry config virtualenvs.in-project false
36-
poetry config virtualenvs.path ~/.cache/poetry/virtualenvs
37-
3836
- name: Install Dependencies
3937
run: poetry install -v
4038
if: steps.cache.outputs.cache-hit != 'true'
4139

4240
- name: Check the code quality
43-
run: make check-code-quality
41+
run: POETRY=poetry make check-code-quality
4442

4543
- name: Check if the code is correctly typed
46-
run: make check-types
44+
run: POETRY=poetry make check-types
4745

4846
Tests:
4947
runs-on: ubuntu-latest
5048
strategy:
5149
matrix:
52-
python-version: [3.6, 3.7, 3.8]
50+
python-version: [3.7, 3.8, 3.9]
5351

5452
steps:
5553
- name: Checkout branch
56-
uses: actions/checkout@v2.3.4
54+
uses: actions/checkout@v2
5755

5856
- name: Setup Python ${{ matrix.python-version }} 🐍
59-
uses: actions/setup-python@v2.1.4
57+
uses: actions/setup-python@v2
6058
with:
6159
python-version: ${{ matrix.python-version }}
6260

6361
- name: Install Poetry
64-
uses: snok/[email protected]
62+
uses: snok/install-poetry@5e4414407e59f94f2148bcb253917dfc22dee7d9
63+
with:
64+
virtualenvs-in-project: false
65+
virtualenvs-path: ~/.cache/poetry/virtualenvs
6566

6667
- uses: actions/cache@v1
6768
name: Cache Poetry deps
@@ -71,21 +72,16 @@ jobs:
7172
restore-keys: |
7273
tests-${{ runner.os }}-${{ matrix.python-version }}-poetry-
7374
74-
- name: Set Poetry config
75-
run: |
76-
poetry config virtualenvs.in-project false
77-
poetry config virtualenvs.path ~/.cache/poetry/virtualenvs
78-
7975
- name: Install Dependencies
8076
run: poetry install -v
8177
if: steps.cache.outputs.cache-hit != 'true'
8278

8379
- name: Run the test suite
84-
run: make test
80+
run: POETRY=poetry make test
8581

8682
- name: Upload coverage to Codecov
8783
if: matrix.python-version == 3.7
88-
uses: codecov/codecov-action@v1.0.15
84+
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b
8985
with:
9086
token: ${{ secrets.CODECOV_TOKEN }}
9187
file: ./coverage.xml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "CI: github-actions-validator"
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
github-actions-validator:
8+
name: Github-actions-validator
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: lumapps/[email protected]

.github/workflows/pypi-publish.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020

21-
- name: Setup Python 3.7 🐍
22-
uses: actions/setup-python@v2.1.4
21+
- name: Setup Python 🐍
22+
uses: actions/setup-python@v2
2323
with:
2424
python-version: 3.7
25-
25+
2626
- name: Install Poetry
27-
uses: snok/[email protected]
27+
uses: snok/install-poetry@5e4414407e59f94f2148bcb253917dfc22dee7d9
28+
with:
29+
virtualenvs-in-project: false
30+
virtualenvs-path: ~/.cache/poetry/virtualenvs
2831

2932
- uses: actions/cache@v1
3033
name: Cache Poetry deps
@@ -38,11 +41,6 @@ jobs:
3841
run: |
3942
git config --local user.email "[email protected]"
4043
git config --local user.name "GitHub Action"
41-
42-
- name: Set Poetry config
43-
run: |
44-
poetry config virtualenvs.in-project false
45-
poetry config virtualenvs.path ~/.cache/poetry/virtualenvs
4644
4745
- name: Install Dependencies
4846
run: poetry install -v --no-interaction
@@ -61,15 +59,15 @@ jobs:
6159
git commit -m "chore(release): release version ${{ github.event.release.tag_name }}"
6260
6361
- name: Push changes
64-
uses: ad-m/github-push-action@master
62+
uses: ad-m/github-push-action@40bf560936a8022e68a3c00e7d2abefaf01305a6
6563
with:
6664
github_token: ${{ secrets.GITHUB_TOKEN }}
6765

6866
- name: Build doc
69-
run: make docs
67+
run: POETRY=poetry make docs
7068

7169
- name: Publish doc
72-
uses: peaceiris/actions-gh-pages@v3
70+
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305
7371
with:
7472
github_token: ${{ secrets.GITHUB_TOKEN }}
75-
publish_dir: ./site
73+
publish_dir: ./site

.github/workflows/pypi.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ jobs:
1616
- name: Checkout branch
1717
uses: actions/[email protected]
1818

19-
- name: Setup Python 3.7 🐍
20-
uses: actions/setup-python@v2.1.4
19+
- name: Setup Python 🐍
20+
uses: actions/setup-python@v2
2121
with:
2222
python-version: 3.7
23-
23+
2424
- name: Install Poetry
25-
uses: snok/[email protected]
25+
uses: snok/install-poetry@5e4414407e59f94f2148bcb253917dfc22dee7d9
26+
with:
27+
virtualenvs-in-project: false
28+
virtualenvs-path: ~/.cache/poetry/virtualenvs
2629

2730
- uses: actions/cache@v1
2831
name: Cache Poetry deps
@@ -31,16 +34,10 @@ jobs:
3134
key: pypi-${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
3235
restore-keys: |
3336
pypi-${{ runner.os }}-poetry-
34-
35-
- name: Set Poetry config
36-
run: |
37-
poetry config virtualenvs.in-project false
38-
poetry config virtualenvs.path ~/.cache/poetry/virtualenvs
39-
37+
4038
- name: Install Dependencies
4139
run: poetry install -v
4240
if: steps.cache.outputs.cache-hit != 'true'
4341

4442
- name: Check that package build
4543
run: poetry build
46-

.github/workflows/release-note.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Create release note
32

43
on:
@@ -14,13 +13,13 @@ jobs:
1413
runs-on: ubuntu-latest
1514
steps:
1615
- name: Checkout code
17-
uses: actions/checkout@v2.3.4
16+
uses: actions/checkout@v2
1817
with:
1918
fetch-depth: 0
20-
19+
2120
- name: Generate changelog
2221
id: generate_changelog
23-
uses: sebastien-boulle/changelog-generator@master
22+
uses: lumapps/changelog-generator@master
2423
env:
2524
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2625

@@ -34,4 +33,4 @@ jobs:
3433
release_name: Release ${{ github.ref }}
3534
body: ${{ steps.generate_changelog.outputs.changelog }}
3635
draft: true
37-
prerelease: false
36+
prerelease: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ http_cache.sqlite
2222
# virtualenv
2323
env/
2424
venv/
25+
.venv/
2526

2627

2728
# doc

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ First install dependencies and setup pre-commits hooks
1010
make setup
1111
```
1212

13+
To setup using a different version of python, you may use the following:
14+
15+
```bash
16+
PYTHON=python3.X make setup
17+
```
18+
1319
Then to go in the poetry virtual env do
1420

1521
```
16-
poetry shell
22+
source .venv/bin/activate
1723
```
1824

1925
You can run `make help` to see all available actions !

Makefile

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
.DEFAULT_GOAL := help
2+
.PHONY: check check-code-quality check-docs check-types clean docs-cp docs docs-serve docs-deploy help format setup test
23

34
PY_SRC := lumapps/
45
CI ?= false
56
TESTING ?= false
7+
PYTHON ?= python3.7
8+
PIP = .venv/bin/pip
9+
POETRY ?= .venv/bin/poetry
610

7-
.PHONY: check
811
check: check-docs check-code-quality check-types ## Check it all!
912

10-
.PHONY: check-code-quality
1113
check-code-quality: ## Check the code quality.
12-
@poetry run failprint -t "Checking code quality" -- flake8 --config=config/flake8.ini $(PY_SRC)
14+
@$(POETRY) run failprint -t "Checking code quality" -- flake8 --config=config/flake8.ini $(PY_SRC)
1315

14-
15-
.PHONY: check-docs
1616
check-docs: ## Check if the documentation builds correctly.
17-
@poetry run failprint -t "Building documentation" -- mkdocs build -s
17+
@$(POETRY) run failprint -t "Building documentation" -- mkdocs build -s
1818

19-
.PHONY: check-types
2019
check-types: ## Check that the code is correctly typed.
21-
@poetry run failprint -t "Type-checking" -- mypy --config-file config/mypy.ini $(PY_SRC)
20+
@$(POETRY) run failprint -t "Type-checking" -- mypy --config-file config/mypy.ini $(PY_SRC)
2221

23-
.PHONY: clean
2422
clean: ## Delete temporary files.
2523
@rm -rf build 2>/dev/null
2624
@rm -rf .coverage* 2>/dev/null
@@ -33,54 +31,37 @@ clean: ## Delete temporary files.
3331
@rm -rf tests/__pycache__ 2>/dev/null
3432
@find . -name "*.rej" -delete 2>/dev/null
3533

36-
.PHONY: docs-cp
3734
docs-cp:
3835
cp README.md docs/index.md
3936
cp LICENSE.md docs/
4037

41-
.PHONY: docs
4238
docs: docs-cp ## Build the documentation locally.
43-
@poetry run mkdocs build
39+
@$(POETRY) run mkdocs build
4440

45-
.PHONY: docs-serve
4641
docs-serve: docs-cp ## Serve the documentation (localhost:8000).
47-
@poetry run mkdocs serve
42+
@$(POETRY) run mkdocs serve
4843

49-
.PHONY: docs-deploy
5044
docs-deploy: docs-cp ## Deploy the documentation on GitHub pages.
51-
@poetry run mkdocs gh-deploy
45+
@$(POETRY) run mkdocs gh-deploy
5246

53-
.PHONY: help
5447
help: ## Print this help.
5548
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
5649

57-
.PHONY: format
5850
format: ## Run formatting tools on the code.
59-
@poetry run failprint -t "Formatting code" -- black $(PY_SRC)
60-
@poetry run failprint -t "Ordering imports" -- isort -y -rc $(PY_SRC)
61-
51+
@$(POETRY) run failprint -t "Formatting code" -- black $(PY_SRC)
52+
@$(POETRY) run failprint -t "Ordering imports" -- isort -y -rc $(PY_SRC)
6253

63-
.PHONY: setup
64-
setup: ## Setup the development environment (install dependencies).
65-
@if ! $(CI); then \
66-
if ! command -v pipx &>/dev/null; then \
67-
pip install pipx; \
68-
fi; \
69-
if ! command -v poetry &>/dev/null; then \
70-
pipx install poetry; \
71-
fi; \
72-
fi; \
73-
poetry config virtualenvs.in-project true
74-
poetry install -v
75-
@if ! $(CI); then \
76-
poetry run pre-commit install; \
77-
poetry run pre-commit install --hook-type commit-msg; \
78-
fi; \
54+
setup: .venv ## Setup the development environment (install dependencies).
55+
$(POETRY) config virtualenvs.in-project true
56+
$(POETRY) install -v
57+
$(POETRY) run pre-commit install
58+
$(POETRY) run pre-commit install --hook-type commit-msg
7959

80-
81-
.PHONY: test
8260
test: ## Run the test suite and report coverage. 2>/dev/null
83-
@poetry run pytest -c config/pytest.ini
84-
@poetry run coverage html --rcfile=config/coverage.ini
85-
61+
@$(POETRY) run pytest -c config/pytest.ini
62+
@$(POETRY) run coverage html --rcfile=config/coverage.ini
8663

64+
.venv: ## Install the virtual env directory
65+
$(PYTHON) -m venv .venv
66+
$(PIP) install --quiet --upgrade pip
67+
$(PIP) install poetry

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ This includes:
1919

2020
## Installation
2121

22-
2322
```bash
2423
pip install lumapps-sdk
2524
```
2625

27-
## Getting started
26+
## Requirements
2827

28+
Python >= 3.7
29+
30+
## Getting started
2931

3032
1. Get your token
3133

@@ -77,7 +79,4 @@ Please refer to our [contributing guidelines](CONTRIBUTING.md).
7779
7880
## Copyright and license
7981
80-
8182
LumApps SDK is released under the [MIT license](LICENSE.md).
82-
83-

config/mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
ignore_missing_imports = true
33

44
[mypy-lumapps.api.client]
5-
ignore_errors = True
5+
ignore_errors = true

0 commit comments

Comments
 (0)