adds script_module; todo on /tmp usage reduction; fleshes out test_ge… #926
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
# This workflow will install Python dependencies, run tests and lint, using | |
# different versions of Python. | |
# | |
# Notes: | |
# - Requires special permission for Github workflows. | |
# - For more information see following: | |
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
# - Based initially on version from https://github.com/LimaBD/batspp. | |
# - Running Github Actions with Docker: https://stackoverflow.com/a/64373702 | |
# - Docker documentation: | |
# https://docs.docker.com/engine/reference/commandline/cli/ | |
# https://docs.docker.com/storage/bind-mounts | |
# - Two separate sets of test environments are used. The GitHub Actions workflow runner VM is | |
# used for different python versions with the latest Ubuntu distribution | |
# | |
name: Github-Tests | |
on: [push, pull_request] | |
jobs: | |
build-and-test-runner: | |
name: Build and Run Tests via Runner VM | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
## TODO: os: [ubuntu-20.04, ubuntu-latest] | |
## OLD: python-version: ["3.8", "3.9", "3.10"] | |
## NOTE: Need 3.8.17+ for typing support, due to backporting limitations with typing_extensions (see html_utils.py) | |
## TODO?: | |
python-version: ["3.8.17", "3.9", "3.10", "3.12"] | |
# Note: The Dockerfile uses 3.11 so try different versions for the runner VM | |
## TODO: python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Python Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ matrix.python-version }}- | |
${{ runner.os }}-pip- | |
- name: Install Dependencies | |
run: | | |
pip install --verbose --requirement requirements.txt | |
## TEST: pip install --verbose --requirement non-binary-requirements.txt | |
- name: Download data | |
run: | | |
## TODO3: put post-install support in mezcla to minimize redundancy | |
python -m nltk.downloader -d "$HOME/nltk_data" punkt averaged_perceptron_tagger stopwords | |
- name: Run Python Tests under Runner | |
run: | | |
PYTHONPATH="$PWD:$PWD/tests:$PYTHONPATH" ./tools/run_tests.bash | |
build-and-test-docker: | |
name: Build and Run Tests via Docker | |
runs-on: [ubuntu-20.04] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Build docker image | |
run: | | |
docker build --tag mezcla-dev -f- . <Dockerfile | |
- name: Run Python Tests under Docker | |
run: | | |
## TODO???: put repo under /mnt/local-mezcla and installed version under /home/mezcla | |
# note: no --env-file used (unlike act.yml) | |
docker run --rm --mount type=bind,source="$(pwd)",target=/home/mezcla mezcla-dev |