forked from pangeo-data/pangeo-docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 1.74 KB
/
Test.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Any PR opened, build images and run tests
name: Test
on:
pull_request:
types: [synchronize]
env:
DOCKER_ORG: pangeo
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
jobs:
base-image:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build Base Image
run: |
cd base-image
docker build -t ${DOCKER_ORG}/base-image:PR .
- name: Save Docker Image
run: |
docker save ${DOCKER_ORG}/base-image:PR | gzip > base-image.tar.gz
- name: Upload Base Image
uses: actions/upload-artifact@v1
with:
name: base-image
path: base-image.tar.gz
matrix-build:
needs: base-image
strategy:
fail-fast: false
matrix:
IMAGE: [base-notebook, pangeo-notebook, ml-notebook]
name: ${{ matrix.IMAGE }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Download Base Docker Image
uses: actions/download-artifact@v1
with:
name: base-image
path: ./artifact
- name: Load Docker Image
run: |
docker load < ./artifact/base-image.tar.gz
docker images
# Create temporary Dockerfile
echo "FROM ${DOCKER_ORG}/base-image:PR" > Dockerfile
- name: Build Image
run: |
cd ${{ matrix.IMAGE }}
docker build -t ${DOCKER_ORG}/${{ matrix.IMAGE }}:PR -f ../Dockerfile .
- name: Export Full Conda Environment
run: |
docker run ${DOCKER_ORG}/${{ matrix.IMAGE }}:PR conda list --export
- name: Test Image
run: |
docker run -u 1000 -w /srv/test -v $PWD:/srv/test ${DOCKER_ORG}/${{ matrix.IMAGE }}:PR ./run_tests.sh ${{ matrix.IMAGE }}