Skip to content

Commit fd238cd

Browse files
authored
Merge pull request #23 from CogStack/smoke-test
docker: Add a smoke test for published images
2 parents 460cce5 + 2530895 commit fd238cd

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/docker.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,41 @@ jobs:
9696
password: ${{ secrets.DOCKERHUB_TOKEN }}
9797
repository: ${{ env.DOCKER_IMAGE_NAME }}
9898
readme-filepath: ./README.md
99+
100+
smoke-test:
101+
needs: build-and-push
102+
if: |
103+
github.repository == 'CogStack/CogStack-ModelServe' &&
104+
(
105+
github.ref == 'refs/heads/main' ||
106+
github.event_name == 'pull_request' ||
107+
github.event_name == 'workflow_dispatch'
108+
)
109+
runs-on: ubuntu-latest
110+
steps:
111+
- uses: actions/checkout@v4
112+
113+
- name: Download the test model
114+
run: |
115+
wget -O test_model.zip https://cogstack-medcat-example-models.s3.eu-west-2.amazonaws.com/medcat-example-models/medmen_wstatus_2021_oct.zip
116+
117+
- name: Run the CMS container
118+
run: |
119+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
120+
docker run -d --name cms-test \
121+
-p 8000:8000 \
122+
-e CMS_MODEL_NAME="Test Model" \
123+
-e CMS_MODEL_TYPE="medcat_umls" \
124+
-v $(pwd)/test_model.zip:/app/model/model.zip \
125+
${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:sha-${SHORT_SHA}
126+
127+
- name: Wait for the CMS container to be ready
128+
run: |
129+
for i in {1..30}; do
130+
if curl -f http://localhost:8000/readyz; then
131+
exit 0
132+
fi
133+
sleep 10
134+
done
135+
echo "CMS did not become ready in time"
136+
exit 1

0 commit comments

Comments
 (0)