Skip to content

Commit

Permalink
Merge branch 'develop' into authors-are-pilots-of-kolibri
Browse files Browse the repository at this point in the history
  • Loading branch information
vkWeb committed Jan 26, 2024
2 parents 0fa6f43 + ffeef95 commit 78a3a08
Show file tree
Hide file tree
Showing 809 changed files with 16,202 additions and 10,530 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build_pex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ jobs:
build_pex:
name: Build PEX
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
outputs:
pex-file-name: ${{ steps.get-pex-filename.outputs.pex-file-name }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
- name: Set up Python 3.6
uses: actions/setup-python@v5
with:
python-version: 3.6
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/build_whl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,31 @@ jobs:
build_whl:
name: Build WHL
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
outputs:
whl-file-name: ${{ steps.get-whl-filename.outputs.whl-file-name }}
tar-file-name: ${{ steps.get-tar-filename.outputs.tar-file-name }}
steps:
- name: Install Git LFS
run: |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Install Ubuntu dependencies
run: |
apt-get -y -qq update
apt-get install -y gettext sudo
sudo apt-get -y -qq update
sudo apt-get install -y gettext
- name: Set up Python 3.6
uses: actions/setup-python@v5
with:
python-version: 3.6
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
- name: Install Yarn
run: npm install -g yarn
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache Node.js modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -53,14 +49,14 @@ jobs:
yarn --frozen-lockfile
npm rebuild node-sass
- name: Cache Python dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache C extensions
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: cext_cache
key: ${{ runner.os }}-cext-${{ hashFiles('requirements/cext*.txt') }}
Expand Down
36 changes: 16 additions & 20 deletions .github/workflows/c_extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ jobs:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.6
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-ext-${{ hashFiles('requirements/*.txt') }}
Expand All @@ -54,29 +52,27 @@ jobs:
# in the kolibri directory
python -m compileall -q kolibri -x py2only
# Until we have staged builds, we will be running this in each and every
# environment even though builds should be done in Py 2.7
# environment even though builds should be done in Py 3.6
make staticdeps
make staticdeps-cext
pip install .
# Start and stop kolibri - disabled until we can move out of a container
# kolibri start --port=8081
# kolibri stop
# Start and stop kolibri
coverage run -p kolibri start --port=8081
coverage run -p kolibri stop
# Run just tests in test/
py.test --cov=kolibri --cov-report= --cov-append --color=no test/
no_c_ext:
name: No C Extensions
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.6
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-no-ext-${{ hashFiles('requirements/*.txt') }}
Expand All @@ -94,11 +90,11 @@ jobs:
# in the kolibri directory
python -m compileall -q kolibri -x py2only
# Until we have staged builds, we will be running this in each and every
# environment even though builds should be done in Py 2.7
# environment even though builds should be done in Py 3.6
make staticdeps
pip install .
# Start and stop kolibri - disabled until we can move out of a container
# kolibri start --port=8081
# kolibri stop
# Start and stop kolibri
coverage run -p kolibri start --port=8081
coverage run -p kolibri stop
# Run just tests in test/
py.test --cov=kolibri --cov-report= --cov-append --color=no test/
2 changes: 1 addition & 1 deletion .github/workflows/check_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with:
python-version: 3.9
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('requirements/docs.txt') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check_licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Cache Node.js modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/no_zombies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
python-version: '3.11'
- name: pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-base-${{ hashFiles('requirements/base.txt') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: tox env cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tox/py3.9
key: ${{ runner.os }}-tox-py3.9-${{ hashFiles('requirements/*.txt') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache Node.js modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/python2lint.yml

This file was deleted.

28 changes: 3 additions & 25 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,13 @@ jobs:
pip install "tox<4"
- name: tox env cache
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
- name: Test with tox
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: tox -e py${{ matrix.python-version }}
unit_test27:
name: Python unit tests (2.7)
needs: pre_job
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v4
- name: Install tox
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: |
python -m pip install --upgrade pip
pip install "tox<4"
- name: tox env cache
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.tox/py2.7
key: ${{ runner.os }}-tox-py2.7-${{ hashFiles('requirements/*.txt') }}
- name: Test with tox
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: tox -e py2.7
postgres:
name: Python postgres unit tests
needs: pre_job
Expand Down Expand Up @@ -112,7 +90,7 @@ jobs:
pip install "tox<4"
- name: tox env cache
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tox/py3.9
key: ${{ runner.os }}-tox-py3.9-${{ hashFiles('requirements/*.txt') }}
Expand Down Expand Up @@ -142,7 +120,7 @@ jobs:
pip install "tox<4"
- name: tox env cache
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }}
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/yarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache Node.js modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
Expand Down
3 changes: 3 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@ If you have contributed to Kolibri, feel free to add your name and Github accoun
| Vikramaditya Singh | Ghat0tkach |
| Kris Katkus | katkuskris |
| Garvit Singhal | GarvitSinghal47 |
| Adars T S | a6ar55 |
| Shivang Rawat | ShivangRawat30 |
| Alex Vélez | AlexVelezLl |
| Mazen Oweiss | moweiss |
18 changes: 4 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL := /bin/bash

# List most target names as 'PHONY' to prevent Make from thinking it will be creating a file of the same name
.PHONY: help clean clean-assets clean-build clean-pyc clean-docs lint test test-all assets coverage docs release test-namespaced-packages staticdeps staticdeps-cext writeversion setrequirements buildconfig pex i18n-extract-frontend i18n-extract-backend i18n-transfer-context i18n-extract i18n-django-compilemessages i18n-upload i18n-pretranslate i18n-pretranslate-approve-all i18n-download i18n-regenerate-fonts i18n-stats i18n-install-font i18n-download-translations i18n-download-glossary i18n-upload-glossary docker-whl docker-demoserver docker-devserver docker-envlist
.PHONY: help clean clean-assets clean-build clean-pyc clean-docs lint test test-all assets coverage docs release staticdeps staticdeps-cext writeversion setrequirements buildconfig pex i18n-extract-frontend i18n-extract-backend i18n-transfer-context i18n-extract i18n-django-compilemessages i18n-upload i18n-pretranslate i18n-pretranslate-approve-all i18n-download i18n-regenerate-fonts i18n-stats i18n-install-font i18n-download-translations i18n-download-glossary i18n-upload-glossary docker-whl docker-demoserver docker-devserver docker-envlist


help:
Expand Down Expand Up @@ -33,7 +33,6 @@ help:
@echo "test: run tests quickly with the default Python"
@echo "test-all: run tests on every Python version with Tox"
@echo "test-with-postgres: run tests quickly with a temporary postgresql backend"
@echo "test-namespaced-packages: verify that we haven't fetched anything namespaced into kolibri/dist"
@echo "coverage: run tests, recording and printing out Python code coverage"
@echo "docs: generate developer documentation"
@echo "start-foreground-with-postgres: run Kolibri in foreground mode with a temporary postgresql backend"
Expand Down Expand Up @@ -152,30 +151,21 @@ release:
@read __
twine upload -s dist/*

test-namespaced-packages:
# This expression checks that everything in kolibri/dist has an __init__.py
# To prevent namespaced packages from suddenly showing up
# https://github.com/learningequality/kolibri/pull/2972
! find kolibri/dist -mindepth 1 -maxdepth 1 -type d -not -name __pycache__ -not -name cext -not -name py2only -not -name *dist-info -exec ls {}/__init__.py \; 2>&1 | grep "No such file"

clean-staticdeps:
rm -rf kolibri/dist/* || true # remove everything
git checkout -- kolibri/dist # restore __init__.py

staticdeps: clean-staticdeps
test "${SKIP_PY_CHECK}" = "1" || python2 --version 2>&1 | grep -q 2.7 || ( echo "Only intended to run on Python 2.7" && exit 1 )
pip2 install -t kolibri/dist -r "requirements.txt"
test "${SKIP_PY_CHECK}" = "1" || python --version 2>&1 | grep -q 3.6 || ( echo "Only intended to run on Python 3.6" && exit 1 )
pip install -t kolibri/dist -r "requirements.txt"
rm -rf kolibri/dist/*.egg-info
rm -r kolibri/dist/man kolibri/dist/bin || true # remove the two folders introduced by pip 10
python2 build_tools/py2only.py # move `future` and `futures` packages to `kolibri/dist/py2only`
make test-namespaced-packages

staticdeps-cext:
rm -rf kolibri/dist/cext || true # remove everything
python build_tools/install_cexts.py --file "requirements/cext.txt" # pip install c extensions
pip install -t kolibri/dist/cext -r "requirements/cext_noarch.txt" --no-deps
rm -rf kolibri/dist/*.egg-info
make test-namespaced-packages

staticdeps-compileall:
bash -c 'python --version'
Expand Down Expand Up @@ -209,7 +199,7 @@ read-whl-file-version:
python ./build_tools/read_whl_version.py ${whlfile} > kolibri/VERSION

pex:
ls dist/*.whl | while read whlfile; do $(MAKE) read-whl-file-version whlfile=$$whlfile; pex $$whlfile --disable-cache -o dist/kolibri-`cat kolibri/VERSION | sed 's/+/_/g'`.pex -m kolibri --python-shebang=/usr/bin/python; done
ls dist/*.whl | while read whlfile; do $(MAKE) read-whl-file-version whlfile=$$whlfile; pex $$whlfile --disable-cache -o dist/kolibri-`cat kolibri/VERSION | sed 's/+/_/g'`.pex -m kolibri --python-shebang=/usr/bin/python3; done

i18n-extract-backend:
cd kolibri && python -m kolibri manage makemessages -- -l en --ignore 'node_modules/*' --ignore 'kolibri/dist/*'
Expand Down
Loading

0 comments on commit 78a3a08

Please sign in to comment.