Kolibri: the offline app for universal education
https://learningequality.org/kolibri/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.6 KiB
85 lines
2.6 KiB
name: Python tests |
|
|
|
on: [push, pull_request] |
|
|
|
jobs: |
|
pre_job: |
|
name: Path match check |
|
runs-on: ubuntu-latest |
|
# Map a step output to a job output |
|
outputs: |
|
should_skip: ${{ steps.skip_check.outputs.should_skip }} |
|
steps: |
|
- id: skip_check |
|
uses: fkirc/skip-duplicate-actions@master |
|
with: |
|
github_token: ${{ github.token }} |
|
paths: '["**.py", "requirements/*.txt"]' |
|
unit_test: |
|
name: Python unit tests |
|
needs: pre_job |
|
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} |
|
runs-on: ubuntu-18.04 |
|
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: Install tox |
|
run: | |
|
python -m pip install --upgrade pip |
|
pip install tox |
|
- name: tox env cache |
|
uses: actions/cache@v2 |
|
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 }} |
|
postgres: |
|
name: Python postgres unit tests |
|
needs: pre_job |
|
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} |
|
runs-on: ubuntu-18.04 |
|
services: |
|
# Label used to access the service container |
|
postgres: |
|
# Docker Hub image |
|
image: postgres |
|
# Provide the password for postgres |
|
env: |
|
POSTGRES_USER: postgres |
|
POSTGRES_PASSWORD: postgres |
|
POSTGRES_DB: test |
|
# Set health checks to wait until postgres has started |
|
options: >- |
|
--health-cmd pg_isready |
|
--health-interval 10s |
|
--health-timeout 5s |
|
--health-retries 5 |
|
ports: |
|
# Maps tcp port 5432 on service container to the host |
|
- 5432:5432 |
|
steps: |
|
- uses: actions/checkout@v2 |
|
- name: Set up Python 3.5 for Postgres |
|
uses: actions/setup-python@v2 |
|
with: |
|
python-version: 3.5 |
|
- name: Install tox |
|
run: | |
|
python -m pip install --upgrade pip |
|
pip install tox |
|
- name: tox env cache |
|
uses: actions/cache@v2 |
|
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 postgres
|
|
|