Initial github actions setup.

pull/7657/head
Richard Tibbles 2 years ago
parent 3e53f7b053
commit 202b0bf283
  1. 27
      .github/workflows/pre-commit.yml
  2. 21
      .github/workflows/python2lint.yml
  3. 39
      .github/workflows/tox.yml
  4. 28
      .github/workflows/yarn.yml
  5. 137
      .travis.yml
  6. 66
      tox.ini

@ -0,0 +1,27 @@
name: Linting
on: [push, pull_request]
jobs:
Linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: |
yarn --frozen-lockfile
npm rebuild node-sass
- uses: pre-commit/action@v2.0.0

@ -0,0 +1,21 @@
name: Python 2 linting
on: [push, pull_request]
jobs:
lint:
name: Python 2 syntax checking
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 2.7
uses: actions/setup-python@v2
with:
python-version: 2.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint with flake8
run: |
flake8 kolibri

@ -0,0 +1,39 @@
name: Python tests
on: [push, pull_request]
jobs:
unit_test:
name: Python unit tests
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: tox env cache
uses: actions/cache@v2
with:
path: ./.tox
key: ${{ runner.os }}-tox-${{ hashFiles('**/requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-tox-
- name: Test with tox
run: tox -e py${{ matrix.python-version }}

@ -0,0 +1,28 @@
name: Javascript Tests
on: [push, pull_request]
jobs:
test:
name: Frontend tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: |
yarn --frozen-lockfile
npm rebuild node-sass
- name: Run tests
run: yarn run coverage

@ -1,137 +0,0 @@
# Config file for automatic testing at travis-ci.org
language: python
dist: trusty
sudo: required
addons:
chrome: stable
services:
- postgresql
cache:
yarn: true
directories:
- node_modules
- $HOME/.cache/pip
- $HOME/.cache/pre-commit
matrix:
include:
- python: "3.6"
env:
- TOX_ENV=timely_shutdown_no_zombies
script:
- tox -e $TOX_ENV
- python: "2.7"
env:
- TOX_ENV=pythonlint2
script:
- tox -e $TOX_ENV
- python: "3.6"
env:
- TOX_ENV=lint
- python: "2.7"
env:
- TOX_ENV=licenses
script:
- tox -e $TOX_ENV
- python: "2.7"
env:
- TOX_ENV=py2.7
script:
- tox -e $TOX_ENV
- python: "3.5"
env:
- TOX_ENV=docs
script:
- tox -e $TOX_ENV
- python: "3.4"
env:
- TOX_ENV=py3.4
- python: "3.5"
env:
- TOX_ENV=py3.5
- python: "3.6"
env:
- TOX_ENV=py3.6
- python: 3.7
dist: xenial
sudo: true
env:
- TOX_ENV=py3.7
- python: 3.8
dist: bionic
sudo: true
env:
- TOX_ENV=py3.8
- python: "2.7"
env:
- TOX_ENV=node10.x
script:
- tox -e $TOX_ENV
- python: "3.5"
env:
- TOX_ENV=postgres
- python: "2.7"
env:
- TOX_ENV=nocext
script:
- tox -e $TOX_ENV
- python: "2.7"
env:
- TOX_ENV=cext
script:
- tox -e $TOX_ENV
before_install:
# Can likely be removed once we stop using Trusty
# https://github.com/travis-ci/travis-ci/issues/8920
- python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
- git fetch
- git describe --tags --always
# Required until this is fixed: https://github.com/travis-ci/travis-ci/issues/9112
- sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60"
- pip install -U pip codecov virtualenv==16.7.9 tox
- . $HOME/.nvm/nvm.sh
- nvm install 10
- nvm use 10
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- psql -c 'create database eco_test1;' -U postgres
- psql -c 'create database eco_test2;' -U postgres
- psql -c 'create database eco_test3;' -U postgres
- psql -c 'create database eco2_test1;' -U postgres
- psql -c 'create database eco2_test2;' -U postgres
- psql -c 'create database eco2_test3;' -U postgres
- psql -c 'create database eco2_test4;' -U postgres
- psql -c 'create database eco2_test5;' -U postgres
# command to run tests
script:
# Get static deps in order to try and compile them all for Python 3
- SKIP_PY_CHECK=1 make staticdeps
# Ensures that we can compile all source code files in this Python 3+ version
# This behavior is disabled in the 'include' matrix above for Python 2.7
- make staticdeps-compileall
# Remove staticdeps again, so they are not part of tox
- make clean-staticdeps
- tox -e $TOX_ENV
after_success:
- coverage combine
- codecov
notifications:
slack:
secure: RH3xqTkkoA2TATYo7onoLlAlw5t7Bek3HqN/e48e1mj3nazTUs05k12e9Cj7I/y7rBu4b1g0Fl4nJ/DOJRD/81o2ML8OAqu4Ngfg149EQysvgHki20CY1LMph0aS5HSACL1yvp8VvDmmpF0F8YGh99ZMeV3qdp0t3AVWSQVIQgVOEjUSPklsf25ikCOqzTRCz90Dp5aIlDUuXtubTATaKQiLfqW8rc/S7Q/JLepmZau5ANFz8cHXn750y6EvEREIE/0gBwH6OWOa1qWCavJPc4z9953zX7rhI85f0eaHVYQ0ojeXJjQG4MOu5kP13tkaLppe1On3fBZLPpeF791EJwgcmEFUd8hDsomfHcxXhHf7+LPwbGjelGr8iY/2ZIWuILY17FmnWyruWyusrHpA1YKBFwjqgo7E06uzwVj9npxbc+WEHuBxTDdaeFYjYRLORvOeJ9y3n+rNs2c9gCvwuq3MzhMWT+KsrrngAibns1Fz/I1YZAY3voipmabeXVLqbLvb8f8xBmwwK14ba0tGMHfnnCfivlruS49qLwpMjASEPY3H8lKyROX94aaWj+B1Fld2kX0L5GN3xkVoT1aJOgOxCF9c7w9Kf1aTcf/T4bfEzjPNf3ZH3rwy/b3YABbQAEdV8SLdrD02+CIYNPzv3/U1y3rmTSg0wLT2elumhv8=

@ -1,5 +1,5 @@
[tox]
envlist = py{2.7,3.4,3.5,3.6,3.7,3.8,pypy}, pythonlint2, lint, node10.x, docs, node, postgres, pythonbuild{2.7,3.4,3.5,3.6,3.7}, cext, nocext
envlist = py{2.7,3.4,3.5,3.6,3.7,3.8}, docs, postgres, cext, nocext
[testenv]
usedevelop = True
@ -13,11 +13,6 @@ setenv =
KOLIBRI_RUN_MODE = tox
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
licenses: python2.7
py2.7: python2.7
py3.4: python3.4
@ -25,11 +20,7 @@ basepython =
py3.6: python3.6
py3.7: python3.7
py3.8: python3.8
pypy: pypy
docs: python3.5
pythonlint2: python2.7
lint: python3.6
node10.x: python2.7
nocext: python2.7
cext: python2.7
timely_shutdown_no_zombies: python3.6
@ -123,67 +114,14 @@ commands =
py.test {posargs:--cov=kolibri --color=no}
# rm -rf {env:KOLIBRI_HOME}
[testenv:pythonlint2]
deps = flake8
commands =
# Ensure we didn't put py3-only syntax
flake8 kolibri
[testenv:lint]
deps = pre-commit
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
[testenv:docs]
deps =
-r{toxinidir}/requirements/docs.txt
commands =
make docs
[node_base]
whitelist_externals =
yarn
npm
commands =
yarn
# Node-sass gets mardy if we don't do this.
npm rebuild node-sass
yarn run coverage
[testenv:node10.x]
whitelist_externals = {[node_base]whitelist_externals}
commands = {[node_base]commands}
[conditional_testing_base]
[testenv:licenses]
whitelist_externals =
{toxinidir}/test/if.sh
[python_build_base]
commands =
{toxinidir}/test/if.sh "setup_changed"
[testenv:pythonbuild2.7]
whitelist_externals = {[conditional_testing_base]whitelist_externals}
commands = {[python_build_base]commands}
[testenv:pythonbuild3.4]
whitelist_externals = {[conditional_testing_base]whitelist_externals}
commands = {[python_build_base]commands}
[testenv:pythonbuild3.5]
whitelist_externals = {[conditional_testing_base]whitelist_externals}
commands = {[python_build_base]commands}
[testenv:pythonbuild3.6]
whitelist_externals = {[conditional_testing_base]whitelist_externals}
commands = {[python_build_base]commands}
[testenv:licenses]
whitelist_externals = {[conditional_testing_base]whitelist_externals}
commands =
{toxinidir}/test/if.sh "requirements_changed"

Loading…
Cancel
Save