bug(medcat): CU-869banbwt Fix issues with installation from source by… #148
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: medcat-trainer qa-build | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| id-token: write | |
| defaults: | |
| run: | |
| working-directory: ./medcat-trainer | |
| jobs: | |
| # Test and build client library | |
| test-client: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: "main" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests pytest build | |
| - name: Install client package in development mode | |
| run: | | |
| cd client | |
| pip install -e . | |
| - name: Run client tests | |
| run: | | |
| cd client | |
| python -m pytest tests/ -v | |
| - name: Bump version for TestPyPI | |
| run: sed -i "s/^version = .*/version = \"1.0.0.dev$(date +%s)\"/" client/pyproject.toml | |
| - name: Build client package | |
| run: | | |
| cd client | |
| python -m build | |
| - name: Publish dev distribution to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository_url: https://test.pypi.org/legacy/ | |
| packages_dir: medcat-trainer/client/dist | |
| test-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v5 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: | | |
| cd webapp/frontend | |
| npm ci | |
| - name: Run frontend tests | |
| run: | | |
| cd webapp/frontend | |
| npm run test:unit | |
| test-backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: "main" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential | |
| - name: Install Rust | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| cd webapp | |
| pip install -r requirements.txt | |
| - name: Download spaCy model | |
| run: | | |
| python -m spacy download en_core_web_md | |
| - name: Run Django tests | |
| env: | |
| DB_ENGINE: sqlite3 | |
| SECRET_KEY: test-secret-key | |
| DEBUG: 1 | |
| run: | | |
| cd webapp/api | |
| python manage.py test | |
| # Build and test webapp container | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test-client | |
| - test-frontend | |
| - test-backend | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: "main" | |
| - name: Build | |
| run: | | |
| docker build -t cogstacksystems/medcat-trainer:latest webapp/. | |
| - name: Run Django Tests | |
| env: | |
| IMAGE_TAG: latest | |
| run: | | |
| # run tests | |
| docker run --rm cogstacksystems/medcat-trainer:latest python manage.py test | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Push to DockerHub | |
| run: | | |
| docker push cogstacksystems/medcat-trainer:latest |