-
Notifications
You must be signed in to change notification settings - Fork 23
50 lines (42 loc) · 1.63 KB
/
build-containers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Build and publish container
on:
push:
branches: [master]
paths: ['runtime/**', '.github/workflows/build-containers.yml']
pull_request:
paths: ['runtime/**', '.github/workflows/build-containers.yml']
jobs:
build:
name: Build, Test, Publish Container
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
proc: ['cpu', 'gpu']
env:
CONTAINER: drivendata/deid2-competition
SHA_TAG: ${{ matrix.proc }}-${{ github.sha }}
LATEST_TAG: ${{ matrix.proc }}-latest
steps:
- uses: actions/checkout@v2
- name: Build ${{ matrix.proc }} Conatiner
run: |
docker build runtime --build-arg CPU_OR_GPU=${{ matrix.proc }} --tag $CONTAINER:$SHA_TAG
docker build runtime --build-arg CPU_OR_GPU=${{ matrix.proc }} --tag $CONTAINER:$LATEST_TAG
- name: Tests container packages
run: |
docker run --mount type=bind,source=$(pwd)/runtime/run-tests.sh,target=/run-tests.sh,readonly \
--mount type=bind,source=$(pwd)/runtime/tests,target=/tests,readonly \
$CONTAINER:$SHA_TAG \
/bin/bash -c "source activate py-${{ matrix.proc }}; python tests/test_installs.py"
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish container if master branch
if: github.ref == 'refs/heads/master'
run: |
docker push $CONTAINER:$SHA_TAG
docker push $CONTAINER:$LATEST_TAG