(BUGFIX) Fix for issue #113 (Only use CSV_FORMAT default if --csv, et… #1009
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 | |
# - The core of mezcla is 3.9+, but there are some utilities for older versions of python. | |
# In addition, it is helpful to use mezcla debugging with other packages, so making sure | |
# mezcla still runs under 3.8 would be good in case the package is older. | |
# - In addition, Python typing went through some unfortunate changes 3.8-3.10, so they will need | |
# to be tested for a while. | |
# | |
# TODO2: | |
# - Add support for weekly or monthly backwards compatibility testing to avoid having to run | |
# 3+ versions on each commit! This should be doable via reusable workflows: | |
# https://docs.github.com/en/actions/sharing-automations/reusing-workflows | |
# | |
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) | |
## TODO1?: Downloads/_github-actions-mezcla-docker-error-28sep24.logpython-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"] | |
## | |
## TEMP: (Docker disabled due to dependeency issue, so 3.11 added): | |
python-version: ["3.10", "3.11", "3.12"] | |
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] | |
## TEMP: Disable docker due to silly dependency problems (and overhead) | |
if: false | |
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 |