Skip to content

Commit

Permalink
Merge pull request #268 from sanger/gpl-842-3-priority-sample
Browse files Browse the repository at this point in the history
GPL-842-3 Fix Docker workflows
  • Loading branch information
pjvv authored Mar 11, 2021
2 parents 9484e5d + f49be85 commit c889181
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 26 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/automated_release_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,28 @@ jobs:
run: >-
docker run
--network host
--env EVE_SETTINGS=test.py
--entrypoint ''
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
python setup_sqlserver_test_db.py
pipenv run python setup_sqlserver_test_db.py
- name: Setup the test MLWH and Events databases
run: >-
docker run
--network host
--env EVE_SETTINGS=test.py
--entrypoint ''
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
python setup_test_db.py
pipenv run python setup_test_db.py
- name: Run tests against the image
run: >-
docker run
--network host
--env EVE_SETTINGS=test.py
--entrypoint ''
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
python -m pytest -vsx
pipenv run python -m pytest --no-cov -vx
- name: Set release tag
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Checks that the .release_version file has been updated
name: Check release bump
name: Check release version bump

on:
pull_request:
Expand All @@ -20,9 +20,9 @@ jobs:
myToken: ${{ github.token }}
view_top: 1

- name: Compare release names
- name: Compare releases
run: >-
if [ "${{ steps.last_release.outputs.tag_name }}" = "$(printf '%s\n' $(cat .release-version)_develop)" ] ||
[ "${{ steps.last_release.outputs.tag_name }}" = "$(printf '%s\n' $(cat .release-version))" ]; then
if [ "${{ steps.last_release.outputs.tag_name }}" = "$(printf 'v%s-develop\n' $(cat .release_version))" ] ||
[ "${{ steps.last_release.outputs.tag_name }}" = "$(printf 'v%s\n' $(cat .release_version))" ]; then
exit 1;
fi
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Docker - build, test and publish
name: Docker - build, test and push

on:
pull_request:
branches:
- develop
- master
push:
tags:
- v*
Expand All @@ -9,7 +13,7 @@ env:
IMAGE_NAME: ${{ github.repository }}/${{ github.event.repository.name }}

jobs:
build_and_test:
build_test_push:
runs-on: ubuntu-18.04
services:
mongodb:
Expand All @@ -33,36 +37,50 @@ jobs:
SA_PASSWORD: MyS3cr3tPassw0rd
steps:
- uses: actions/checkout@v2

- name: Build the Docker image
run: >-
docker build .
--file Dockerfile
--tag docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
- name: Create SQL Server testing database
run: >-
docker run
--network host
--env EVE_SETTINGS=test.py
--entrypoint ''
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
python setup_sqlserver_test_db.py
pipenv run python setup_sqlserver_test_db.py
- name: Setup the test MLWH and Events databases
run: >-
docker run
--network host
--env EVE_SETTINGS=test.py
--entrypoint ''
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
python setup_test_db.py
pipenv run python setup_test_db.py
- name: Run tests against the image
run: >-
docker run
--network host
--env EVE_SETTINGS=test.py
--entrypoint ''
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
python -m pytest -vsx
pipenv run python -m pytest --no-cov -vsx
- name: Login to registry
if: ${{ github.event_name == 'push' }}
run: >-
docker login
-u ${{ github.actor }}
-p ${{ secrets.GITHUB_TOKEN }}
docker.pkg.github.com
- name: Publish image with image tag being either develop/master/<tag_name>
if: ${{ github.event_name == 'push' }}
run: >-
docker push
docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ COPY --chown=lighthouse Pipfile.lock ./
RUN pipenv sync --dev

# Copy all the source to the image
COPY . .
COPY --chown=lighthouse . .

# https://docs.docker.com/engine/reference/builder/#healthcheck
HEALTHCHECK --interval=1m --timeout=3s \
Expand Down
19 changes: 6 additions & 13 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c889181

Please sign in to comment.