Skip to content

Commit

Permalink
Add workflow for testing docker image.
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbar committed Jan 25, 2024
1 parent 918153d commit 4e599e8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Python package
on: [push, pull_request]

jobs:
build-package:
dry-run:

runs-on: ubuntu-latest

Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,37 @@ jobs:
run: |
coveralls --service=github
test-docker:
name: Build docker image and run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

- name: Cache docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-

- name: Build image run unit tests
env:
IMAGE: ${{ github.repository }}:${{ github.sha }}
NAME: deepcell-spots-test
run: |
docker buildx build --load --tag ${{ env.IMAGE }} .
docker run -d -it \
--entrypoint=bash \
--name ${{ env.NAME }} \
${{ env.IMAGE }}
docker cp requirements-test.txt ${{ env.NAME }}:/opt/deepcell-spots/requirements-test.txt
docker exec ${{ env.NAME }} pip install -r /opt/deepcell-spots/requirements-test.txt
docker exec ${{ env.NAME }} pytest /opt/deepcell-spots/deepcell
docker kill ${{ env.NAME }} && docker rm ${{ env.NAME }}
coveralls:
name: Finish Coveralls
needs: tests
Expand Down

0 comments on commit 4e599e8

Please sign in to comment.