Skip to content

Commit 072f2fe

Browse files
committed
CU-869a4wpek Trainer qa workflow fix (#99)
* CU-869a4wpek: Change version before building and publishing * CU-869a4wpek: Make QA workflow run at PR time * CU-869a4wpek: Make QA workflow run at PR time for workflow changes * CU-869a4wpek: Avoid running QA workflow during PR
1 parent 81d6247 commit 072f2fe

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: medcat-trainer qa-build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
defaults:
8+
run:
9+
working-directory: ./medcat-trainer
10+
11+
jobs:
12+
# Test and build client library
13+
test-client:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout main
17+
uses: actions/checkout@v4
18+
with:
19+
ref: 'main'
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.10'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install requests pytest build
30+
31+
- name: Install client package in development mode
32+
run: |
33+
cd client
34+
pip install -e .
35+
36+
- name: Run client tests
37+
run: |
38+
cd client
39+
python -m pytest tests/ -v
40+
41+
- name: Bump version for TestPyPI
42+
run: sed -i "s/^version = .*/version = \"1.0.0.dev$(date +%s)\"/" client/pyproject.toml
43+
44+
- name: Build client package
45+
run: |
46+
cd client
47+
python -m build
48+
49+
- name: Publish dev distribution to Test PyPI
50+
uses: pypa/[email protected]
51+
with:
52+
password: ${{ secrets.MEDCAT_TRAINER_TEST_PYPI_API_TOKEN }}
53+
repository_url: https://test.pypi.org/legacy/
54+
packages_dir: medcat-trainer/client/dist
55+
56+
# Build and test webapp container
57+
build-and-push:
58+
runs-on: ubuntu-latest
59+
needs: test-client
60+
steps:
61+
- name: Checkout main
62+
uses: actions/checkout@v4
63+
with:
64+
ref: 'main'
65+
66+
- name: Build
67+
run: |
68+
docker build -t cogstacksystems/medcat-trainer:latest webapp/.
69+
70+
- name: Run Django Tests
71+
env:
72+
IMAGE_TAG: latest
73+
run: |
74+
# run tests
75+
docker run --rm cogstacksystems/medcat-trainer:latest python manage.py test
76+
77+
- name: Login to DockerHub
78+
uses: docker/login-action@v3
79+
with:
80+
username: ${{ secrets.DOCKERHUB_USERNAME }}
81+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
82+
83+
- name: Push to DockerHub
84+
run: |
85+
docker push cogstacksystems/medcat-trainer:latest

0 commit comments

Comments
 (0)