Skip to content

Commit

Permalink
update docker-ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hasan7n committed Jul 17, 2023
1 parent 2ffd3e9 commit 43dc8a2
Showing 1 changed file with 52 additions and 31 deletions.
83 changes: 52 additions & 31 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,63 @@
# This workflow runs inside a github actions docker container. The workflow
# itself runs another docker container for hosting the dev server which is
# configured with some specific configurations (container network, port...)
# so that it works properly within the docker-in-docker setup. Keep in mind
# that github actions mounts the docker daemon path when running the
# workflow container.
#
# ******** NOTE ********
# MLCubes use docker behind the scenes by default. We don't have direct
# control over how docker commands are called by the MLCube, so care
# should be taken when we start using new container configurations
# inside the mlcube (e.g. networking)

name: Integration local docker workflow

on: pull_request
on: pull_request_target

jobs:
authorize:
environment:
'testing-external-code'
runs-on: ubuntu-latest
steps:
- run: true
setup:
needs: authorize
name: local-docker-deploy
runs-on: ubuntu-latest
container:
image: mlcommons/medperf-tests-container:latest
options: --privileged --name medperf-tests
volumes:
- /tmp:/tmp # To share the directory where the test dataset is downloaded
- /github/home/.medperf:/github/home/.medperf # To share medperf storage
env:
IMAGE_NAME: medperf-api:test
MOCK_USERS_PASSWORD: ${{ secrets.MEDPERF_MOCK_USERS_PASSWORD }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Setup Chrome
run: |
sudo apt-get install -y wget
wget -O chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_114.0.5735.198-1_amd64.deb
sudo dpkg -i chrome.deb
rm chrome.deb
- name: Install Singularity
run: |
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev uuid-dev libgpgme11-dev \
squashfs-tools libseccomp-dev wget pkg-config git cryptsetup debootstrap libglib2.0-dev
wget https://go.dev/dl/go1.17.11.linux-amd64.tar.gz
sudo tar --directory=/usr/local -xzvf go1.17.11.linux-amd64.tar.gz
export PATH=/usr/local/go/bin:$PATH
wget https://github.com/sylabs/singularity/releases/download/v3.10.0/singularity-ce-3.10.0.tar.gz
tar -xzvf singularity-ce-3.10.0.tar.gz
cd singularity-ce-3.10.0
./mconfig
cd builddir
make
sudo make install
- name: Install dependencies
working-directory: .
run: |
python -m pip install --upgrade pip
pip install -e cli/
pip install -r cli/test-requirements.txt
pip install -r server/requirements.txt
pip install -r server/test-requirements.txt
- name: Set server environment vars
working-directory: ./server
Expand All @@ -45,23 +73,16 @@ jobs:

- name: Run server in background
working-directory: ./server
run: PORT=8000 && docker run --name medperf-api -d --network container:medperf-tests -e PORT=${PORT} -e SSL_FLAGS="--certfile=cert.crt --keyfile=cert.key" ${{ env.IMAGE_NAME }}
run: PORT=8080 && docker run --name medperf_api -d -p 8000:${PORT} -e PORT=${PORT} -e SSL_FLAGS="--certfile=cert.crt --keyfile=cert.key" ${{ env.IMAGE_NAME }}

- name: Run integration tests
- name: Run server integration tests
working-directory: ./server
run: pip install -r test-requirements.txt --user && python seed.py --cert cert.crt

- name: Install dependencies
working-directory: .
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f cli/requirements.txt ]; then pip install -e cli; fi
run: docker exec -e MOCK_USERS_PASSWORD medperf_api sh -c "pip install -r test-requirements.txt && python seed.py --server https://127.0.0.1:8080 --cert cert.crt"

- name: Run chestxray demo
working-directory: .
run: sh cli/cli_chestxray_tutorial_test.sh -f

- name: Run client integration tests
working-directory: .
run: sh cli/cli_tests.sh
run: sh cli/cli_tests.sh -f

0 comments on commit 43dc8a2

Please sign in to comment.