Skip to content

Merge branch 'dev' into 1294-use-logger-in-srcacquisition-code #3280

Merge branch 'dev' into 1294-use-logger-in-srcacquisition-code

Merge branch 'dev' into 1294-use-logger-in-srcacquisition-code #3280

Workflow file for this run

name: CI
on:
push
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: mkdir -p repos/undefx
- name: Checkout undefx/py3tester
uses: actions/checkout@v2
with:
repository: undefx/py3tester
path: repos/undefx/py3tester
- name: Checkout undefx/undef-analysis
uses: actions/checkout@v2
with:
repository: undefx/undef-analysis
path: repos/undefx/undef-analysis
- run: mkdir -p repos/delphi
- name: Checkoutcmu-delphi/operations
uses: actions/checkout@v2
with:
repository: cmu-delphi/operations
path: repos/delphi/operations
- name: Checkout cmu-delphi/utils
uses: actions/checkout@v2
with:
repository: cmu-delphi/utils
path: repos/delphi/utils
- name: Checkout cmu-delphi/github-deploy-repo
uses: actions/checkout@v2
with:
repository: cmu-delphi/github-deploy-repo
path: repos/delphi/github-deploy-repo
- name: Checkout THIS REPO
uses: actions/checkout@v2
with:
path: repos/delphi/delphi-epidata
- name: Checkout cmu-delphi/flu-contest
uses: actions/checkout@v2
with:
repository: cmu-delphi/flu-contest
path: repos/delphi/flu-contest
- name: Checkout cmu-delphi/nowcast
uses: actions/checkout@v2
with:
repository: cmu-delphi/nowcast
path: repos/delphi/nowcast
- name: Build docker images
run: |
docker build -t delphi_database_epidata -f ./repos/delphi/delphi-epidata/dev/docker/database/epidata/Dockerfile .
docker build -t delphi_web_python -f repos/delphi/delphi-epidata/dev/docker/python/Dockerfile .
sudo docker build -t delphi_redis -f repos/delphi/delphi-epidata/dev/docker/redis/Dockerfile .
cd ./repos/delphi/delphi-epidata
docker build -t delphi_web_epidata -f ./devops/Dockerfile .
cd ../../../
# MODULE_NAME specifies the location of the `app` variable, the actual WSGI application object to run.
# see https://github.com/tiangolo/meinheld-gunicorn-docker#module_name
- name: Start database and Redis services
run: |
docker network create --driver bridge delphi-net
docker run --rm -d -p 13306:3306 --network delphi-net --name delphi_database_epidata --cap-add=sys_nice delphi_database_epidata
docker run --rm -d -p 6379:6379 --network delphi-net --env "REDIS_PASSWORD=1234" --name delphi_redis delphi_redis
- run: |
wget https://raw.githubusercontent.com/eficode/wait-for/master/wait-for
chmod +x wait-for
./wait-for localhost:13306 -- echo 'ready'
sleep 10s
- name: Start delphi_web_epidata
run: |
docker run --rm -d -p 10080:80 --env "MODULE_NAME=delphi.epidata.server.main" --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "REDIS_HOST=delphi_redis" --env "REDIS_PASSWORD=1234" --env "API_KEY_REGISTER_WEBHOOK_TOKEN=abc" --env "API_KEY_ADMIN_PASSWORD=test_admin_password" --env "TESTING_MODE=True" --network delphi-net --name delphi_web_epidata delphi_web_epidata
docker ps
- name: Run Unit Tests
run: |
docker run --rm --network delphi-net --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" delphi_web_python python -m pytest --import-mode importlib repos/delphi/delphi-epidata/tests
- name: Run Integration Tests
run: |
docker run --rm --network delphi-net delphi_web_python python -m pytest --import-mode importlib repos/delphi/delphi-epidata/integrations
- name: Clean Up
run: |
docker stop delphi_database_epidata delphi_web_epidata delphi_redis
docker network remove delphi-net
build_js_client:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/client/packaging/npm
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node2-
- run: npm ci
- run: npm test
image:
needs: build
# only on main and dev branch
# TODO: #1112 Remove `|| github.ref == 'refs/heads/api-keys'` after transition to production status.
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/api-keys'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: cmu-delphi-deploy-machine
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}
- name: Build Image
env:
DEVOPS_DOCKER_FILE: ./devops/Dockerfile
run: |
docker build -t repo --file ${DEVOPS_DOCKER_FILE} .
- name: Resolve Tag
id: tagname
run: |
baseRef="${GITHUB_REF#*/}"
imageTag="${baseRef#*/}"
if [ "$imageTag" = "main" ] ; then
imageTag="latest"
fi
echo "::set-output name=tag::$imageTag"
echo "::set-output name=repo::ghcr.io/${{ github.repository }}"
- name: Push Dev Tag
run: |
docker tag repo ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }}
docker push ${{ steps.tagname.outputs.repo }}:${{ steps.tagname.outputs.tag }}
# - name: Extract version
# if: startsWith(github.ref, 'refs/heads/main')
# id: extract_version
# run: node -pe "'::set-output name=version::' + require('./package.json').version"
- name: Trigger Webhook
run: |
# trigger a webhook update
curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
-X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "repository=${{ steps.tagname.outputs.repo }}&tag=${{ steps.tagname.outputs.tag }}"
# - name: Push Version Tag Tag
# if: startsWith(github.ref, 'refs/heads/main')
# run: |
# docker tag repo ${{ steps.tagname.outputs.repo }}:v${{ steps.extract_version.outputs.version }}
# docker push ${{ steps.tagname.outputs.repo }}:v${{ steps.extract_version.outputs.version }}