The logic here seems to work, but Django 4.0 won't install over our other pinned requirements, so tests fail for Django 4.0.
105 lines
2.9 KiB
YAML
105 lines
2.9 KiB
YAML
name: unit-tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
run-tests:
|
|
if: github.repository == 'openedx/edx-platform' || github.repository == 'edx/edx-platform-private'
|
|
runs-on: [ edx-platform-runner ]
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.8']
|
|
django-version:
|
|
- "pinned"
|
|
#- "4.0"
|
|
shard_name: [
|
|
"lms-1",
|
|
"lms-2",
|
|
"lms-3",
|
|
"lms-4",
|
|
"lms-5",
|
|
"lms-6",
|
|
"openedx-1",
|
|
"openedx-2",
|
|
"openedx-3",
|
|
"openedx-4",
|
|
"cms-1",
|
|
"cms-2",
|
|
"common-1",
|
|
"common-2",
|
|
"common-3",
|
|
]
|
|
|
|
|
|
name: python-${{ matrix.python-version }},django-${{ matrix.django-version }},${{ matrix.shard_name }}
|
|
steps:
|
|
- name: sync directory owner
|
|
run: sudo chown runner:runner -R .*
|
|
|
|
- name: checkout repo
|
|
uses: actions/checkout@v2
|
|
|
|
# This gives Mongo several chances to start. We started getting flakiness
|
|
# around 2022-02-15 wherein the start command would sometimes exit with:
|
|
#
|
|
# * Starting database mongodb
|
|
# ...fail!
|
|
#
|
|
# ...not having produced any logs or other output. We couldn't figure out
|
|
# what was causing Mongo to fail, so this is a (temporary?) hack to get
|
|
# PRs unblocked.
|
|
- name: start mongod server for tests
|
|
run: |
|
|
sudo mkdir -p /data/db
|
|
sudo chmod -R a+rw /data/db
|
|
mongod &
|
|
|
|
- name: install requirements
|
|
run: |
|
|
sudo pip install -r requirements/pip.txt
|
|
sudo pip install -r requirements/edx/testing.txt
|
|
if [[ "${{ matrix.django-version }}" == "pinned" ]]; then
|
|
sudo pip install -r requirements/edx/django.txt
|
|
else
|
|
sudo pip install "django~=${{ matrix.django-version }}.0"
|
|
fi
|
|
|
|
- name: list installed package versions
|
|
run: |
|
|
sudo pip freeze
|
|
|
|
- name: Setup and run tests
|
|
uses: ./.github/actions/unit-tests
|
|
|
|
compile-warnings-report:
|
|
runs-on: [ edx-platform-runner ]
|
|
needs: [ run-tests ]
|
|
steps:
|
|
- name: sync directory owner
|
|
run: sudo chown runner:runner -R .*
|
|
- uses: actions/checkout@v2
|
|
- name: collect pytest warnings files
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pytest-warnings-json
|
|
path: test_root/log
|
|
|
|
- name: display structure of downloaded files
|
|
run: ls -la test_root/log
|
|
|
|
- name: compile warnings report
|
|
run: |
|
|
python openedx/core/process_warnings.py --dir-path test_root/log --html-path reports/pytest_warnings/warning_report_all.html
|
|
|
|
- name: save warning report
|
|
if: success()
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: pytest-warning-report-html
|
|
path: |
|
|
reports/pytest_warnings/warning_report_all.html
|