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

Update all jobs to avoid ubuntu-20.04 image removal #13163

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 3 additions & 5 deletions .github/workflows/build_pex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ on:
jobs:
build_pex:
name: Build PEX
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: python:3.6-buster
outputs:
pex-file-name: ${{ steps.get-pex-filename.outputs.pex-file-name }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.6
uses: actions/setup-python@v5
with:
python-version: 3.6
- uses: actions/cache@v4
with:
path: ~/.cache/pip
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build_whl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ on:
jobs:
build_whl:
name: Build WHL
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: python:3.6-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 Ubuntu dependencies
run: |
apt-get -y -qq update
apt-get install -y gettext sudo sqlite3 binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf git-lfs
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Install Ubuntu dependencies
run: |
sudo apt-get -y -qq update
sudo apt-get install -y gettext sudo sqlite3 binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf
- 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: '18.x'
- name: Install Yarn
run: npm install -g yarn@1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down
100 changes: 0 additions & 100 deletions .github/workflows/c_extensions.yml

This file was deleted.

34 changes: 31 additions & 3 deletions .github/workflows/morango_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
github_token: ${{ github.token }}
paths: '["requirements/base.txt", ".github/workflows/morango_integration.yml"]'
morango_integration_tests_sqlite:
name: Morango Integration Tests
name: Morango Integration Tests for currently supported Python versions
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
INTEGRATION_TEST: 'true'
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
python-version: [3.9, '3.10', '3.11', '3.12']

steps:
- name: Checkout repository
Expand All @@ -53,6 +53,34 @@ jobs:
- name: Test with tox
run: tox -e py${{ matrix.python-version }} -- kolibri/core/auth/test/test_morango_integration.py

morango_integration_tests_sqlite_eol_python:
name: Morango Integration Tests for EOL Python versions
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
env:
INTEGRATION_TEST: 'true'
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
container:
image: python:${{ matrix.python-version }}-buster
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install "tox<4"
- name: tox env cache
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
run: tox -e py${{ matrix.python-version }} -- kolibri/core/auth/test/test_morango_integration.py


morango_integration_tests_postgres:
name: Morango Integration Tests with PostgreSQL
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/pr_build_kolibri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,46 @@ jobs:
with:
deb-file-name: ${{ needs.deb.outputs.deb-file-name }}
ref: v1.0.0
test_whl_file:
name: Test WHL file
needs: whl
strategy:
matrix:
python-version: [3.9, '3.10', '3.11', '3.12']
cext: [true, false]
runs-on: ubuntu-latest
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: ${{ needs.whl.outputs.whl-file-name }}
path: dist
- name: Install WHL file
run: pip install dist/${{ needs.whl.outputs.whl-file-name }}
- name: Smoke test WHL file
env:
KOLIBRI_NO_C_EXTENSIONS: ${{ matrix.cext == false && '1' || '' }}
run: kolibri setup
test_whl_file_eol_python:
name: Test WHL file with EOL Python versions
needs: whl
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
cext: [true, false]
runs-on: ubuntu-latest
container:
image: python:${{ matrix.python-version }}-buster
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ needs.whl.outputs.whl-file-name }}
- name: Install WHL file
run: pip install dist/${{ needs.whl.outputs.whl-file-name }}
- name: Smoke test WHL file
env:
KOLIBRI_NO_C_EXTENSIONS: ${{ matrix.cext == false && '1' || '' }}
run: kolibri setup
2 changes: 1 addition & 1 deletion .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
github_token: ${{ github.token }}
paths: '["**.py", "requirements/*.txt", ".github/workflows/tox.yml", "tox.ini"]'
unit_test:
name: Python unit tests
name: Python unit tests for currently supported Python versions
needs: pre_job
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
python-version: [3.9, '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand All @@ -53,6 +53,32 @@ jobs:
- name: Test with tox
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
run: tox -e py${{ matrix.python-version }}
unit_test_eol_python:
name: Python unit tests for EOL Python versions
needs: pre_job
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8]
container:
image: python:${{ matrix.python-version }}-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@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 }}
postgres:
name: Python postgres unit tests
needs: pre_job
Expand Down
9 changes: 7 additions & 2 deletions kolibri/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def settings_module():
"KOLIBRI_APK_VERSION_NAME": {
"description": "Version name for the Kolibri APK (Android Installer)",
},
"KOLIBRI_NO_C_EXTENSIONS": {
"description": "Disable C extensions.",
},
"LISTEN_PID": {
"description": """
The PID of the process to listen for signals from -
Expand Down Expand Up @@ -136,15 +139,17 @@ def set_env():
from the distributed version in case it exists before importing anything
else.
"""

monkey_patch_markdown()
monkey_patch_distutils()

from kolibri import dist as kolibri_dist # noqa

sys.path = [os.path.realpath(os.path.dirname(kolibri_dist.__file__))] + sys.path

# Add path for c extensions to sys.path
prepend_cext_path(os.path.realpath(os.path.dirname(kolibri_dist.__file__)))
if not os.environ.get("KOLIBRI_NO_C_EXTENSIONS", False):
# Add path for c extensions to sys.path
prepend_cext_path(os.path.realpath(os.path.dirname(kolibri_dist.__file__)))

# Set default env
for key, value in ENVIRONMENT_VARIABLES.items():
Expand Down
4 changes: 3 additions & 1 deletion kolibri/utils/tests/test_sanity_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
class SanityCheckTestCase(TestCase):
@patch("kolibri.utils.sanity_checks.logging.error")
@override_option(
"Paths", "CONTENT_DIR", "Z:\\NOTREAL" if sys.platform == "win32" else "/dir_dne"
"Paths",
"CONTENT_DIR",
"Z:\\NOTREAL" if sys.platform == "win32" else "/proc/self/mem/impossible",
)
def test_content_dir_dne(self, logging_mock):
with self.assertRaises(SystemExit):
Expand Down