Merge pull request #569 from kbase/dev-pyver #1129
This file contains hidden or 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
| name: KBase CDM Task Service tests | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - ready_for_review | |
| push: | |
| # run workflow when merging to main or develop | |
| branches: | |
| - main | |
| - master | |
| - develop | |
| jobs: | |
| task_service_tests: | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: "3.12.13" | |
| mongo: "mongodb-linux-x86_64-ubuntu2204-7.0.18" | |
| minio: "2025-02-07T23-21-09Z" # minimum supported version | |
| mc: "2024-08-13T05-33-17Z" | |
| steps: | |
| - name: Repo checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies and set up test config | |
| shell: bash | |
| run: | | |
| export CRANE_VER=v0.21.2 | |
| export HOMEDIR=`pwd` | |
| # set up python dependencies | |
| export UV_PROJECT_ENVIRONMENT="${pythonLocation}" | |
| uv sync --locked | |
| # move to parent dir of homedir to install binaries etc | |
| cd .. | |
| # set up crane | |
| # don't bother to verify provenance here | |
| curl -sL "https://github.com/google/go-containerregistry/releases/download/$CRANE_VER/go-containerregistry_Linux_x86_64.tar.gz" > go-containerregistry.tar.gz | |
| tar -zxf go-containerregistry.tar.gz | |
| export CRANE_EXE_PATH=`pwd`/crane | |
| # set up Mongo | |
| wget -q http://fastdl.mongodb.org/linux/${{matrix.mongo}}.tgz | |
| tar xfz ${{matrix.mongo}}.tgz | |
| export MONGOD=`pwd`/${{matrix.mongo}}/bin/mongod | |
| # set up Minio | |
| wget -q https://dl.minio.io/server/minio/release/linux-amd64/archive/minio.RELEASE.${{matrix.minio}} -O minio | |
| chmod a+x minio | |
| export MINIOD=`pwd`/minio | |
| wget -q https://dl.minio.io/client/mc/release/linux-amd64/archive/mc.RELEASE.${{matrix.mc}} -O mc | |
| chmod a+x mc | |
| export MINIO_MC=`pwd`/mc | |
| # set up test config | |
| cd $HOMEDIR | |
| cp test.cfg.example test.cfg | |
| sed -i "s#^test.crane.exe=.*#test.crane.exe=$CRANE_EXE_PATH#" test.cfg | |
| sed -i "s#^test.mongo.exe=.*#test.mongo.exe=$MONGOD#" test.cfg | |
| sed -i "s#^test.minio.exe=.*#test.minio.exe=$MINIOD#" test.cfg | |
| sed -i "s#^test.minio.mc.exe=.*#test.minio.mc.exe=$MINIO_MC#" test.cfg | |
| cat test.cfg | |
| - name: Run tests | |
| shell: bash | |
| run: PYTHONPATH=. pytest --cov=cdmtaskservice --cov-report=xml test | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true |