Merge pull request #12 from learningequality/extraneous #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", ".github/workflows/python.yml"]' | |
unit_test: | |
name: Python unit tests | |
needs: pre_job | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
pip install -r requirements-test.txt | |
- name: cache Python env | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: py3.9-${{ hashFiles('requirements*.txt') }} | |
- name: Install and enable kolibri_sync_extras plugin | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
env: | |
KOLIBRI_HOME: .kolibri | |
run: | | |
pip install . | |
kolibri plugin enable kolibri_sync_extras_plugin | |
- name: Run tests | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
run: | | |
python -O -m pytest --reuse-db |