From 8cab3a1169df49f912c473ad67df5f47a9136a5b Mon Sep 17 00:00:00 2001 From: Jeff Zohrab Date: Fri, 17 May 2024 15:39:37 -0700 Subject: [PATCH] Add plugin tests to ci. --- .github/workflows/ci.yml | 62 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b088f70..c85ecc2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: # A branch github-ci-updates can be created and used for ci # experiments and tweaks. - branches: [ "develop", "master", "github-ci", "windows" ] + branches: [ "develop", "master", "github-ci", "windows", "pr_413_continued_plugins" ] pull_request: branches: [ "develop", "master" ] @@ -142,6 +142,66 @@ jobs: run: inv accept -s -k disabled_data_is_hidden + # Run all plugin tests. + # + # For each plugin: + # - install Lute requirements + # - install plugin reqs + # - run tests. + # + # The Lute requirements are installed first b/c the plugins may come + # with their own conflicting requirements. Doing a full req install + # will (hopefully) uncover conflicts. + plugins: + runs-on: ubuntu-latest + timeout-minutes: 30 + + strategy: + matrix: + python_version: [ '3.8', '3.9', '3.10', '3.11' ] + + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python_version }} + cache: 'pip' # caching pip dependencies + + # Plugins likely won't need this config file, but just in case ... + - 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 + ls ${{ github.workspace }} + cat ${{ github.workspace }}/lute/config/config.yml + + - name: test all plugins + run: | + for plugin in $(ls plugins); do + # Lute reqs + pip install . + pushd plugins/$plugin + pip install . + # Note for future: some plugins may have extra reqs not covered by pip + # (e.g. mecab uses apt-get and exports etc). Idea for future: plugin + # could have a .github folder as well with additional setup scripts. + + pytest tests + + # pip uninstall $plugin -y + # NOTE: Not bothering to do an uninstall! + # if multiple plugins have different/clashing version requirements, + # perhaps it is best to run into problems in ci. + # This may ultimately come back to haunt me, but it will do for now. + popd + done + code-quality: runs-on: ubuntu-latest