Skip to content

Commit f713469

Browse files
chore(medcat-trainer): CU-869a4br6j Create a copy of the v1 medcat-trainer in the v1 folder (#97)
* build(medcat-trainer): CU-869a4br6j Create Github actions for medcat-trainer v1
1 parent 8f4fbda commit f713469

File tree

290 files changed

+29229
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+29229
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: medcat-trainer-v1 ci-build
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'v1/medcat-trainer/**'
7+
- '.github/workflows/medcat-trainer-v1**'
8+
9+
defaults:
10+
run:
11+
working-directory: ./v1/medcat-trainer
12+
13+
jobs:
14+
# Test and build client library
15+
test-client:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout main
19+
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.ref }}
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.10'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install requests pytest build
32+
33+
- name: Install client package in development mode
34+
run: |
35+
cd client
36+
pip install -e .
37+
38+
- name: Run client tests
39+
run: |
40+
cd client
41+
python -m pytest tests/ -v
42+
43+
- name: Build client package
44+
run: |
45+
cd client
46+
python -m build
47+
48+
# Build and test webapp container
49+
build-and-push:
50+
runs-on: ubuntu-latest
51+
needs: test-client
52+
steps:
53+
- name: Checkout main
54+
uses: actions/checkout@v4
55+
with:
56+
ref: ${{ github.ref }}
57+
58+
- name: Build
59+
env:
60+
IMAGE_TAG: ${{ env.RELEASE_VERSION }}
61+
run: |
62+
docker build -t cogstacksystems/medcat-trainer:dev-latest webapp/.
63+
- name: Run Django Tests
64+
env:
65+
IMAGE_TAG: ${{ env.RELEASE_VERSION }}
66+
run: |
67+
# run tests
68+
docker run --rm cogstacksystems/medcat-trainer:dev-latest python manage.py test
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: medcat-trainer-v1 qa-build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
defaults:
8+
run:
9+
working-directory: ./v1/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: Build client package
42+
run: |
43+
cd client
44+
python -m build
45+
46+
# - name: Publish dev distribution to Test PyPI
47+
# uses: pypa/[email protected]
48+
# with:
49+
# password: ${{ secrets.MEDCAT_TRAINER_TEST_PYPI_API_TOKEN }}
50+
# repository_url: https://test.pypi.org/legacy/
51+
# packages_dir: v1/medcat-trainer/client/dist
52+
53+
# Build and test webapp container
54+
build-and-push:
55+
runs-on: ubuntu-latest
56+
needs: test-client
57+
steps:
58+
- name: Checkout main
59+
uses: actions/checkout@v4
60+
with:
61+
ref: 'main'
62+
63+
- name: Build
64+
run: |
65+
docker build -t cogstacksystems/medcat-trainer:v1-latest webapp/.
66+
67+
- name: Run Django Tests
68+
env:
69+
IMAGE_TAG: latest
70+
run: |
71+
# run tests
72+
docker run --rm cogstacksystems/medcat-trainer:v1-latest python manage.py test
73+
74+
- name: Login to DockerHub
75+
uses: docker/login-action@v3
76+
with:
77+
username: ${{ secrets.DOCKERHUB_USERNAME }}
78+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
79+
80+
- name: Push to DockerHub
81+
run: |
82+
docker push cogstacksystems/medcat-trainer:v1-latest
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: medcat-trainer-v1 release-build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'medcat-trainer/v1.*.*'
7+
8+
defaults:
9+
run:
10+
working-directory: ./v1/medcat-trainer
11+
12+
jobs:
13+
# Test, build and publish client library
14+
test-and-publish-client:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout main
18+
uses: actions/checkout@v4
19+
with:
20+
ref: "main"
21+
22+
- name: Release Tag
23+
# If GITHUB_REF=refs/tags/medcat-trainer/v0.1.2, this returns v0.1.2. Note it's including the "v" though it probably shouldnt
24+
run: echo "RELEASE_VERSION=${GITHUB_REF##refs/*/}" >> $GITHUB_ENV
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.10'
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install requests pytest build twine
35+
36+
- name: Install client package in development mode
37+
run: |
38+
cd client
39+
pip install -e .
40+
41+
- name: Run client tests
42+
run: |
43+
cd client
44+
python -m pytest tests/ -v
45+
46+
- name: Build client package
47+
run: |
48+
cd client
49+
python -m build
50+
51+
- name: Publish production distribution to PyPI
52+
if: startsWith(github.ref, 'refs/tags') && ! github.event.release.prerelease
53+
uses: pypa/[email protected]
54+
with:
55+
# TODO CU-869a25n7e Use Trusted Platform Publisher based PyPI release
56+
password: ${{ secrets.PYPI_API_TOKEN }}
57+
packages_dir: v1/medcat-trainer/client/dist
58+
59+
# Build and test webapp container
60+
build-and-push:
61+
runs-on: ubuntu-latest
62+
needs: test-and-publish-client
63+
steps:
64+
- name: Checkout main
65+
uses: actions/checkout@v4
66+
with:
67+
ref: "main"
68+
69+
- name: Release Tag
70+
# If GITHUB_REF=refs/tags/medcat-trainer/v0.1.2, this returns v0.1.2. Note it's including the "v" though it probably shouldnt
71+
run: echo "RELEASE_VERSION=${GITHUB_REF##refs/*/}" >> $GITHUB_ENV
72+
- name: Build
73+
env:
74+
IMAGE_TAG: ${{ env.RELEASE_VERSION }}
75+
run: |
76+
docker build -t cogstacksystems/medcat-trainer:$IMAGE_TAG webapp/.
77+
- name: Run Django Tests
78+
env:
79+
IMAGE_TAG: ${{ env.RELEASE_VERSION }}
80+
run: |
81+
# run tests
82+
docker run --rm cogstacksystems/medcat-trainer:$IMAGE_TAG python manage.py test
83+
84+
- name: Login to DockerHub
85+
uses: docker/login-action@v3
86+
with:
87+
username: ${{ secrets.DOCKERHUB_USERNAME }}
88+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
89+
90+
- name: Push to DockerHub
91+
env:
92+
IMAGE_TAG: ${{ env.RELEASE_VERSION }}
93+
run: |
94+
docker push cogstacksystems/medcat-trainer:$IMAGE_TAG
95+

v1/medcat-trainer/.env-example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# MedCAT
2+
SPACY_MODELS="en_core_web_sm en_core_web_md en_core_web_lg"
3+
4+
# Ports
5+
MCTRAINER_PORT=8001
6+
SOLR_PORT=8983

v1/medcat-trainer/.gitignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#Directories to be ignored fully
2+
/books/
3+
/articles/
4+
/other/
5+
/output/
6+
/graphics/
7+
/webapp/models/*
8+
data/
9+
tmp/
10+
*_tmp/
11+
.idea
12+
13+
/webapp/frontend/dist/*
14+
/webapp/api/media/*
15+
/webapp/api/static/*
16+
17+
# Configuration
18+
.env
19+
20+
# Keep folders with this
21+
!.keep
22+
23+
#tmp and similar files
24+
.nfs*
25+
*.pyc
26+
*.out
27+
*.swp
28+
*.swn
29+
tmp_*
30+
t_*
31+
tmp_*
32+
*_tmp
33+
*.swo
34+
*.lyx.emergency
35+
*.lyx#
36+
*~
37+
*.log
38+
*hidden*
39+
db.sqlite3
40+
nohup.out
41+
tmp.py
42+
43+
# docs outputs
44+
docs/_build
45+
46+
# macOS system files
47+
.DS_Store
48+
*/.DS_Store
49+
50+
# Jupyter Notebook checkpoints
51+
*/.ipynb_checkpoints/*
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-20.04
9+
tools:
10+
python: "3.9"
11+
12+
sphinx:
13+
configuration: medcat-trainer/docs/conf.py
14+
15+
python:
16+
install:
17+
- requirements: medcat-trainer/docs/requirements.txt

0 commit comments

Comments
 (0)