-
Notifications
You must be signed in to change notification settings - Fork 4
80 lines (78 loc) · 2.91 KB
/
testing_docker.yaml
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
72
73
74
75
76
77
78
79
80
name: Testing Docker image
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
tags:
- v*
schedule:
# Every 01:00 Sunday re-run the test on the main branch
- cron: '0 1 * * 0'
workflow_dispatch:
jobs:
docker_testing:
runs-on: ubuntu-latest
name: Running Docker testing
steps:
- name: Fetch source code
uses: actions/checkout@v2
- name: Current python version
run: python3 --version || echo python3 not installed
- name: Install Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Updated python version
run: python3 --version
- name: Install python dependencies
run: |
python3 -m pip install -U pip
python3 -m pip install -U numpy Pillow
- name: Create folders
run: |
mkdir ./inputs && chmod 777 ./inputs
mkdir ./outputs && chmod 777 ./outputs
- name: Download testing data files
run: |
curl -X GET https://de.cyverse.org/dl/d/3CBFD03C-C82E-4EDE-A8E5-DD4DBD45C696/orthomosaic.tif > inputs/orthomosaic.tif
curl -X GET https://de.cyverse.org/dl/d/FD32B0CE-DBAB-4A44-B8A6-0E9AA4555A31/experiment.yaml > inputs/experiment.yaml
mkdir -p test_data
curl -X GET https://de.cyverse.org/dl/d/D06CA5FF-34CE-46F6-91BD-C93167678941/orthomosaicmask_1.tif > test_data/orthomosaic_mask.tif
- name: Folder contents
run: |
echo "Current folder" && ls -l
echo "Inputs folder" && ls -l ./inputs
echo "Outputs folder" && ls -l ./outputs
- name: Build docker image
run: docker build -t soilmask_test:latest ./
- name: Compress docker image
run: docker save soilmask_test:latest | gzip -7 -c - > soilmask_test_image.tar.gz
- name: Upload docker image
uses: actions/upload-artifact@v2
with:
name: soilmask_test_image
path: soilmask_test_image.tar.gz
- name: Run docker test
run: docker run --rm -v "${PWD}/inputs:/inputs" -v "${PWD}/outputs:/outputs" soilmask_test:latest --working_space /outputs --metadata /inputs/experiment.yaml /inputs/orthomosaic.tif
- name: Output folder contents
run: echo "Outputs folder" && ls -l ./outputs
- name: Check outputs
run: |
chmod +x "./.github/workflows/docker_test_check.sh"
"./.github/workflows/docker_test_check.sh"
- name: Data quality check
run: python3 tests/compare_image_pixels.py './test_data/orthomosaic_mask.tif' './outputs/orthomosaic_mask.tif'
artifact_cleanup:
runs-on: ubuntu-latest
needs: [docker_testing]
name: Cleanup artifacts upon success
steps:
- name: Remove docker artifact
uses: geekyeggo/delete-artifact@v1
with:
name: soilmask_test_image