Skip to content

wip2

wip2 #125

Workflow file for this run

name: ci
on:
push:
# A branch github-ci-updates can be created and used for ci
# experiments and tweaks.
branches: [ "develop", "master", "github-ci-updates" ]
pull_request:
branches: [ "develop", "master" ]
permissions:
contents: read
jobs:
# Lint, format check, and all tests.
base-ci:
if: false # disable for now
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y mecab mecab-ipadic-utf8
# Helper checks to find the mecab library path,
# so it can be exported before running tests.
# Without the export, natto-py fails on github.
# echo FIND THE LIB:
# which mecab
# actual=`readlink -f /usr/bin/mecab`
# ldd $actual
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt
- name: Setup config
run: |
mkdir ${{ github.workspace }}/data
echo "ENV: dev" > ${{ github.workspace }}/lute/config/config.yml
echo "DATAPATH: ${{ github.workspace }}/data" >> ${{ github.workspace }}/lute/config/config.yml
echo "DBNAME: test_lute.db" >> ${{ github.workspace }}/lute/config/config.yml
echo "MECAB_PATH: /lib/x86_64-linux-gnu/libmecab.so.2" >> ${{ github.workspace }}/lute/config/config.yml
ls ${{ github.workspace }}
cat ${{ github.workspace }}/lute/config/config.yml
- name: Lint
run: inv lint
- name: Coding style
run: |
black --check .
- name: Test
run: |
# Have to explicitly set MECAB_PATH for natto-py.
export MECAB_PATH=/lib/x86_64-linux-gnu/libmecab.so.2
pytest
# Note that these seem to *pass* even if an acceptance
# test fails in GitHub actions ... which is annoying,
# because everything passes/fails correctly locally.
- name: Acceptance testing
run: |
export MECAB_PATH=/lib/x86_64-linux-gnu/libmecab.so.2
inv accept --headless -s
- name: Remove mecab for smoke test without mecab
run: |
sudo apt-get remove -y mecab mecab-ipadic-utf8
# Run one particular sanity check.
#
# Note this isn't _completely_ valid because the test loads
# only supported language stories, whereas a prod release
# comes with _all_ stories pre-loaded and the invalid ones
# are deleted ...
- name: Smoke test no mecab
run: inv accept --headless -s -k test_unsupported_language_not_shown
- name: Check flit package
run: |
mkdir ${{ github.workspace }}/../lute_flit
cd ${{ github.workspace }}/../lute_flit
flit -f ${{ github.workspace }}/pyproject.toml install
python -m lute.main & # Start in background process
sleep 2
# Verify with utils script back in the workspace
# (verify.py is not included in flit install)
pushd ${{ github.workspace }}
python -m utils.verify
popd
pkill -f "python -m lute.main" # Kill that process.
windows-ci:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
cache: 'pip' # caching pip dependencies
- name: Setup config
run: |
mkdir ${{ github.workspace }}\data
echo "ENV: dev" > ${{ github.workspace }}\lute\config\config.yml
echo "DATAPATH: ${{ github.workspace }}\data" >> ${{ github.workspace }}\lute\config\config.yml
echo "DBNAME: test_lute.db" >> ${{ github.workspace }}\lute\config\config.yml
shell: cmd
- run: pip install -r requirements.txt
# Run one particular sanity check.
- name: Smoke test no mecab
run: inv accept --headless -s -k test_unsupported_language_not_shown
- name: Check flit package
run: |
mkdir ${{ github.workspace }}\..\lute_flit
cd ${{ github.workspace }}\..\lute_flit
flit -f ${{ github.workspace }}\pyproject.toml install
shell: cmd
- name: Run Lute application
run: |
echo "python -m lute.main" > run-server.bat
cmd /c "START /b run-server.bat"
- name: Wait for application to start
run: Start-Sleep -Seconds 10
- name: Verify flit install
run: |
cd ${{ github.workspace }}
python -m utils.verify