Skip to content

Commit

Permalink
Merge branch 'main' into lorenzo-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoFerraces authored Jan 15, 2024
2 parents 0bced77 + 42cebaf commit 6527c5a
Show file tree
Hide file tree
Showing 48 changed files with 1,151 additions and 542 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/act-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Comment": "Configuration for running-act event flag (see https://github.com/nektos/act#skipping-jobs)",
"act": true
}
16 changes: 13 additions & 3 deletions .github/workflows/act.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on: [push, pull_request]
jobs:

build-and-test-runner:
name: Run Tests
name: Build and Run Tests via Runner
# skip during local actions testing (see https://github.com/nektos/act#skipping-jobs)
if: ${{ !github.event.act }}

runs-on: ${{ matrix.os }}
strategy:
# Note: The matrix is only for the GitHub runner VM. Separate support is needed
Expand Down Expand Up @@ -47,9 +50,14 @@ jobs:
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install --verbose --requirement requirements.txt
## TEST: pip install --verbose --requirement non-binary-requirements.txt
- name: Download data
run: |
python -m nltk.downloader -d "$HOME/nltk_data" punkt averaged_perceptron_tagger stopwords
- name: Run Python Tests Directly
- name: Run Python Tests via Runner
run: |
PYTHONPATH="$(pwd):$PYTHONPATH" ./tools/run_tests.bash
Expand All @@ -61,6 +69,8 @@ jobs:

build-and-test-docker:
name: Build and Run Tests via Docker
# include unless skip-docker set (see skip-docker.json)
if: ${{ !github.event.skip-docker }}
runs-on: [ubuntu-20.04]

## TEST:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ on: [push, pull_request]
jobs:

build-and-test-runner:
name: Build and Run Tests
runs-on: ${{ matrix.os }}
name: Build and Run Tests via Runner
# skip during local actions testing (see https://github.com/nektos/act#skipping-jobs)
if: ${{ !github.event.act }}

runs-on: ${{ matrix.os }}
strategy:
# Note: The matrix is only for the GitHub runner VM. Separate support is needed
# by the docker container.
Expand Down Expand Up @@ -57,9 +59,14 @@ jobs:
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install --verbose --requirement requirements.txt
## TEST: pip install --verbose --requirement non-binary-requirements.txt
- name: Download data
run: |
python -m nltk.downloader -d "$HOME/nltk_data" punkt averaged_perceptron_tagger stopwords
- name: Run Python Tests Directly
- name: Run Python Tests via Runner
run: |
PYTHONPATH="$(pwd):$PYTHONPATH" ./tools/run_tests.bash
Expand All @@ -71,6 +78,8 @@ jobs:

build-and-test-docker:
name: Build and Run Tests via Docker
# include unless skip-docker set (see skip-docker.json)
if: ${{ !github.event.skip-docker }}
runs-on: [ubuntu-20.04]

## TEST:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/github-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Comment": "Configuration for not-running-act event flag (see https://github.com/nektos/act#skipping-jobs)",
"act": false
}
6 changes: 4 additions & 2 deletions .github/workflows/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on: [push, pull_request]
jobs:

build-and-test-runner:
name: Build and Run Tests via Workflow Runner VM
name: Build and Run Tests via Runner VM
runs-on: ${{ matrix.os }}

strategy:
Expand Down Expand Up @@ -54,10 +54,12 @@ jobs:
- name: Install Dependencies
run: |
pip install -r requirements.txt
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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/skip-docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Comment": "Configuration for skip-docker event flag (see https://github.com/nektos/act#skipping-jobs)",
"skip-docker": true
}
4 changes: 4 additions & 0 deletions .github/workflows/use-docker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Comment": "Configuration for use-docker event flag (see https://github.com/nektos/act#skipping-jobs)",
"skip-docker": false
}
31 changes: 23 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# - Mostly based initially on
# https://stackoverflow.com/a/70866416 [How to install python specific version on docker?]
# - For Docker docs, see https://docs.docker.com/get-started.
# - The avoid linux continuation characters (i.e., \<newline), <<END-style heredocs are used: See
# https://www.docker.com/blog/introduction-to-heredocs-in-dockerfiles
# This allows for commenting out code (e.g., inline comment within heredoc group).
#
# Usage:
# 1. Build the image:
Expand Down Expand Up @@ -98,12 +101,16 @@ RUN if [ "$PYTHON_VERSION" == "" ]; then
COPY ./requirements.txt $REQUIREMENTS

# Install the package requirements
# This is normally handled via workflow, but is needed if docker used standalone.
# NOTE: The workflow only handles requirements for the runner VM, not the docker container.
## TEST: RUN if [ "$PYTHON_VERSION" != "" ]; then \
RUN if [ "$(which nltk)" == "" ]; then \
python -m pip install --verbose --no-cache-dir --requirement $REQUIREMENTS; \
fi
# NOTE: The workflow only handles requirements for the runner VM, not the docker container;
# Also, the results aren't cached to save space in the image.
RUN <<END_RUN
if [ "$(which nltk)" == "" ]; then
python -m pip install --verbose --no-cache-dir --requirement $REQUIREMENTS;
## TODO?
## # note: makes a second pass for failed installations, doing non-binary
## python -m pip install --verbose --no-cache-dir --ignore-installed --no-binary --requirement $REQUIREMENTS;
fi
END_RUN
## TODO3: add option for optional requirements (likewise, for all via '#full#")
## RUN python -m pip install --verbose $(perl -pe 's/^#opt#\s*//g;' $REQUIREMENTS | grep -v '^#')

Expand All @@ -115,9 +122,17 @@ RUN python -m nltk.downloader -d /usr/local/share/nltk_data punkt averaged_perce

# Install required tools and libraries (TODO: why lsb-release?)
# Note: cleans the apt-get cache
RUN apt-get update -y && apt-get install -y lsb-release && apt-get clean all
RUN apt-get update -y && apt-get install --yes lsb-release && apt-get clean all
# note: rcs needed for merge (TODO: place in required-packages.txt)
RUN apt-get install rcs
RUN apt-get install --yes enchant-2 rcs

# Show disk usage when debugging
RUN <<END_RUN
if [ "$DEBUG_LEVEL" -ge 5 ]; then
echo "Top directories by disk usage:";
du --block-size=1K / 2>&1 | sort -rn | head -20;
fi
END_RUN

# Run the test, normally pytest over mezcla/tests
# Note: the status code (i.e., $?) determines whether docker run succeeds (e.g., OK if 0)
Expand Down
2 changes: 1 addition & 1 deletion mezcla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Tom O'Hara
Feb 2022
"""
version = "1.3.9.6"
version = "1.3.9.7"
__VERSION__ = version
__version__ = __VERSION__

Expand Down
Loading

0 comments on commit 6527c5a

Please sign in to comment.