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

Initial github-actions configuration #1

Merged
merged 10 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Initial github-actions configuration
  • Loading branch information
danigm committed Jan 18, 2021
commit 5628321da477c228fd0514c4dbdd4c2c497ec0b6
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kolibri-tools/.eslintrc');
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox

- name: Lint
run: tox -e lint
24 changes: 24 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Yarn build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
node10:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox

- name: Node10
run: tox -e node10.x
29 changes: 29 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test python

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
py:
runs-on: ubuntu-18.04
strategy:
matrix:
python: [ 2.7, 3.5, 3.6, 3.7, 3.8 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox

- name: python
env:
PYTHON: py${{ matrix.python }}
run: tox -e $PYTHON
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
*.swp

node_modules/*
kolibri_explore_plugin/static/*
kolibri_explore_plugin/build/*
kolibri_explore_plugin/__pycache__
build/*
dist/*
kolibri_explore_plugin.egg-info/*

# virtual environment
venv/
.python-version
.envrc
.env
Pipfile
1 change: 1 addition & 0 deletions .htmlhintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kolibri-tools/.htmlhintrc');
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
exclude: (\.git/|\.tox/|\.venv/|build/|static/|dist/|node_modules/)
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: trailing-whitespace
- id: flake8
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: end-of-file-fixer
exclude: '^.+?(\.json|\.po)$'
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.3.3
hooks:
- id: reorder-python-imports
language_version: python2.7
- repo: local
hooks:
- id: lint-frontend
name: Linting of JS, Vue, SCSS and CSS files
description: This hook handles all frontend linting for Kolibri
entry: yarn run lint-frontend:format
language: system
files: \.(js|vue|scss|css)$

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kolibri-tools/.prettierrc');
1 change: 1 addition & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kolibri-tools/.stylelintrc');
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,30 @@ Deployment
----------

1. Clone this repo.
2. Open terminal in your Kolibri repo.
3. Run the following commands, with your Kolibri development virtual env
enabled:
2. Install dependencies with pipenv

```
pipenv --python 3
pipenv shell
pip install -r requirements.txt --upgrade
```

3. Install node.js and yarn

```
nodeenv -p --node=10.15.3
npm install -g yarn
```

3. Install plugin javascript dependencies and build

```
yarn install
```

4. Now that all dependencies are installed, it's possible to build using make

```
make dist
```

Expand All @@ -51,13 +69,7 @@ folder.

5. Upload to PyPi:

You should have python `twine` package installed:

```
pip install twine
```

Then you can publish the generated `dist/kolibri_explore_plugin*.whl` to pypi
You can publish the generated `dist/kolibri_explore_plugin*.whl` to pypi
just running:

```
Expand All @@ -83,3 +95,12 @@ calling the `make dist` again, you should remove the `kolibri_explore_plugin`:
```
pip uninstall kolibri_explore_plugin
```

Configure precommit hook
------------------------

To run lint before any commit just run this command:

```
pre-commit install -f --install-hooks
```
2 changes: 1 addition & 1 deletion kolibri_explore_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.1'
__version__ = "0.0.1"
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"scripts": {
"build": "kolibri-tools build prod --plugins kolibri_explore_plugin",
"clean": "kolibri-tools build clean --plugins kolibri_explore_plugin",
"dev": "kolibri-tools build dev --plugins kolibri_explore_plugin --port 4000"
"dev": "kolibri-tools build dev --plugins kolibri_explore_plugin --port 4000",
"lint-frontend": "kolibri-tools lint -p 'kolibri_explore_plugin/assets/**/*.{js,vue,scss,less,css}'",
"lint-frontend:format": "yarn run lint-frontend --write"
},
"name": "kolibri-explore-render-plugin",
"description": "Explore Plugin for Kolibri",
Expand Down
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nodeenv==1.3.3
ipdb==0.13.2
flake8==3.8.3
pre-commit==1.15.1
tox==3.1.3
twine
9 changes: 9 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# These are for testing
coverage==4.5.1
mock==2.0.0
pytest==3.7.1 # pyup: < 4.0.0
pytest-cov==2.5.1
pytest-django==3.3.3
pytest-env==0.6.2
pytest-pythonpath==0.7.2
sh==1.12.14
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup

import kolibri_explore_plugin


Expand Down
80 changes: 80 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[tox]
envlist = py{2.7,3.4,3.5,3.6,3.7,3.8,pypy}, pythonlint2, lint, node10.x, pythonbuild{2.7,3.4,3.5,3.6,3.7}

[testenv]
usedevelop = True
whitelist_externals=
rm
make
sh
setenv =
SKIP_PY_CHECK = 1
basepython =
pythonbuild2.7: python2.7
pythonbuild3.4: python3.4
pythonbuild3.5: python3.5
pythonbuild3.6: python3.6
pythonbuild3.7: python3.7
py2.7: python2.7
py3.4: python3.4
py3.5: python3.5
py3.6: python3.6
py3.7: python3.7
py3.8: python3.8
pypy: pypy
pythonlint2: python2.7
lint: python3.6
node10.x: python2.7
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements/test.txt
commands =
{[python_build_base]commands}

[testenv:pythonlint2]
deps = flake8
commands =
# Ensure we didn't put py3-only syntax
flake8 kolibri_explore_plugin

[testenv:lint]
deps = pre-commit
commands =
{[node_base]commands}
# Install yarn dependencies
yarn
# Node-sass gets mardy if we don't do this.
npm rebuild node-sass
pre-commit install -f --install-hooks
pre-commit run --all-files

[node_base]
commands =
nodeenv -p --node=10.15.3
npm install -g yarn

[testenv:node10.x]
commands =
{[node_base]commands}
yarn
yarn build

[python_build_base]
commands =
{[node_base]commands}
yarn
make dist
# Test whl installation
pip install {toxinidir}/dist/kolibri_explore_plugin-0.0.1-py2.py3-none-any.whl

[testenv:pythonbuild2.7]
commands = {[python_build_base]commands}

[testenv:pythonbuild3.4]
commands = {[python_build_base]commands}

[testenv:pythonbuild3.5]
commands = {[python_build_base]commands}

[testenv:pythonbuild3.6]
commands = {[python_build_base]commands}
Loading