Skip to content

Commit fcec5c4

Browse files
committed
Adding code from private eduk repo
Thanks django-eduk for all your services. This big part of your code is now open-source.
1 parent 7c02867 commit fcec5c4

Some content is hidden

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

64 files changed

+5564
-1
lines changed

.codeclimate.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "2"
2+
plugins:
3+
bandit:
4+
enabled: true
5+
checks:
6+
method-complexity:
7+
config:
8+
threshold: 7
9+
argument-count:
10+
config:
11+
enabled: false

.github/workflows/main.yaml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Github CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
linter:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
17+
- name: Set up Python 3.8
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: 3.8
21+
22+
- name: Cache dependencies
23+
uses: actions/cache@v1
24+
with:
25+
path: ~/.cache/pypoetry
26+
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
27+
28+
- name: Install Python dependencies
29+
run: |
30+
make dependencies
31+
env:
32+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
33+
34+
- name: Lint with pylint
35+
run: |
36+
make lint
37+
38+
setup:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v1
42+
43+
- name: Set up Python 3.8
44+
uses: actions/setup-python@v1
45+
with:
46+
python-version: 3.8
47+
48+
- name: Cache dependencies
49+
uses: actions/cache@v1
50+
with:
51+
path: ~/.cache/pypoetry
52+
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }}
53+
54+
- name: Install Python dependencies
55+
run: |
56+
make dependencies
57+
env:
58+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
59+
60+
- name: Build the package
61+
run: |
62+
poetry build
63+
64+
unit:
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/checkout@v1
69+
70+
- name: Set up Python 3.8
71+
uses: actions/setup-python@v1
72+
with:
73+
python-version: 3.8
74+
75+
- name: Install Python dependencies
76+
run: |
77+
make dependencies
78+
env:
79+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
80+
81+
- name: Prepare coverage
82+
run: |
83+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
84+
chmod +x ./cc-test-reporter
85+
./cc-test-reporter before-build
86+
87+
- name: Unit test with nose test suite
88+
run: |
89+
make unit
90+
env:
91+
LOG_LEVEL: ERROR
92+
93+
- name: Report coverage
94+
run: |
95+
poetry run coverage xml
96+
GIT_COMMIT_SHA=`[[ -z "$GITHUB_HEAD_REF" ]] && echo $GITHUB_SHA || echo ${{ github.event.pull_request.head.sha }}` GIT_BRANCH=`[[ -z "$GITHUB_HEAD_REF" ]] && echo ${GITHUB_REF/refs\/heads\/} || echo $GITHUB_HEAD_REF` ./cc-test-reporter after-build -t coverage.py --exit-code $?
97+
env:
98+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

.github/workflows/publish.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python 3.8
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: 3.8
16+
- name: Setup Environment
17+
run: |
18+
make setup
19+
- name: Build & Release package
20+
run: |
21+
make publish
22+
env:
23+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/release.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tag & Release Package
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Set up Python 3.8
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.8
17+
- name: Setup Environment
18+
run: |
19+
make setup
20+
env:
21+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
22+
- name: Detect version upgrade
23+
id: versioning
24+
run: |
25+
package_version=$(echo $(poetry version -v) | sed "s/glassfrog //")
26+
echo "::set-output name=package_version::"$package_version
27+
upgraded=$(git tag --list | grep -q "${package_version}$" && echo "false" || echo "true")
28+
echo "::set-output name=upgraded::"$upgraded
29+
pre_release=$([[ $package_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "false" || echo "true")
30+
echo "::set-output name=pre_release::"$pre_release
31+
- name: Create Release
32+
if: ${{ steps.versioning.outputs.upgraded == 'true' }}
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
tag_name: ${{ steps.versioning.outputs.package_version }}
38+
release_name: Release ${{ steps.versioning.outputs.package_version }}
39+
body: |
40+
Auto-released by bot.
41+
See commit changes.
42+
draft: false
43+
prerelease: ${{ steps.versioning.outputs.pre_release }}
44+
- name: Build & Release package
45+
if: ${{ steps.versioning.outputs.upgraded == 'true' }}
46+
run: |
47+
make publish
48+
env:
49+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/updater.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
schedule:
3+
- cron: '0 0 * * 1' # every monday at 00:00
4+
5+
name: Update packages
6+
jobs:
7+
release:
8+
name: Update dependencies
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python 3.8
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: 3.8
16+
- name: Install Python dependencies
17+
run: |
18+
make dependencies
19+
env:
20+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
21+
- name: Update dependencies
22+
run: |
23+
make update
24+
poetry version patch
25+
env:
26+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
27+
- name: Create Pull Request
28+
id: cpr
29+
uses: peter-evans/create-pull-request@v2
30+
with:
31+
token: ${{ secrets.PAT }}
32+
base: master
33+
branch: feature/auto-update
34+
commit-message: Updated dependencies
35+
title: 'Dependency Update'
36+
body: |
37+
All dependencies have been update by the Github Action bot.
38+
labels: dependencies
39+
team-reviewers: developers
40+
draft: false
41+
request-to-parent: false
42+
- name: Check outputs
43+
run: |
44+
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
45+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"

.gitignore

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
47+
# Translations
48+
*.mo
49+
*.pot
50+
51+
# Django stuff:
52+
*.log
53+
54+
# Sphinx documentation
55+
docs/_build/
56+
57+
# PyBuilder
58+
target/
59+
60+
\.idea/

0 commit comments

Comments
 (0)