-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from AgPipeline/develop
Merging develop into master - no review
- Loading branch information
Showing
6 changed files
with
249 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Checks that the docker test run succeeded | ||
|
||
# Define expected results | ||
EXPECTED_FILES=("rgb_plot.csv") | ||
EXPECTED_GREENNESS_VALUES=(2.3 0 20.55 1.6 52.72 -50.42 22.85 10.66 1.01 0.0 0.33) | ||
|
||
# What folder are we looking in for outputs | ||
if [[ ! "${1}" == "" ]]; then | ||
TARGET_FOLDER="${1}" | ||
else | ||
TARGET_FOLDER="./outputs" | ||
fi | ||
|
||
# What our target file to read is | ||
if [[ ! "${2}" == "" ]]; then | ||
CHECK_FILE="${2}" | ||
else | ||
CHECK_FILE="rgb_plot.csv" | ||
fi | ||
EXPECTED_FILES+=("${CHECK_FILE}") | ||
|
||
# Check if expected files are found | ||
for i in $(seq 0 $(( ${#EXPECTED_FILES[@]} - 1 ))) | ||
do | ||
if [[ ! -f "${TARGET_FOLDER}/${EXPECTED_FILES[$i]}" ]]; then | ||
echo "Expected file ${EXPECTED_FILES[$i]} is missing" | ||
exit 10 | ||
fi | ||
done | ||
|
||
# Check the results of the canopy cover calculation | ||
RESULT_VALUES=(`gawk ' | ||
BEGIN { | ||
FPAT = "([^,]+)|(\"[^\"]+\")" | ||
} | ||
{ | ||
if ($1 != "germplasmName") { # Skipping the header line | ||
printf("(%s %s %s %s %s %s %s %s %s %s %s)\n", $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) | ||
} | ||
} | ||
END { | ||
} | ||
' "${TARGET_FOLDER}/${CHECK_FILE}"`) | ||
|
||
echo "Result counts: ${#EXPECTED_GREENNESS_VALUES[@]} vs ${#RESULT_VALUES[@]}" | ||
if [[ ${#EXPECTED_GREENNESS_VALUES[@]} != ${#RESULT_VALUES[@]} ]]; then | ||
echo "Number of results found in file (${#RESULT_VALUES[@]}) don't match expected count (${#EXPECTED_GREENNESS_VALUES[@]})" | ||
if [[ ${#RESULT_VALUES[@]} > 0 ]]; then | ||
for i in $(seq 0 $(( ${#RESULT_VALUES[@]} - 1 ))) | ||
do | ||
echo "${i}: ${RESULT_VALUES[$i]}" | ||
done | ||
fi | ||
exit 20 | ||
fi | ||
|
||
#for i in $(seq 0 $(( ${#EXPECTED_GREENNESS_VALUES[@]} - 1 ))) | ||
#do | ||
# # Check that we have the same number values | ||
# CUR_EXPECTED=${EXPECTED_GREENNESS_VALUES[$i]} | ||
# CUR_VALUES=${RESULT_VALUES[$i]} | ||
# if [[ ${#CUR_EXPECTED[@]} != ${#CUR_VALUES[@]} ]]; then | ||
# echo "Row ${i}: Expected ${#CUR_EXPECTED[@]} values and received ${#CUR_VALUES[@]}" | ||
# exit 30 | ||
# fi | ||
# | ||
# # Check each of the values | ||
# for j in $(seq 0 $(( ${#CUR_EXPECTED[@]} - 1 ))) | ||
# do | ||
# if [[ "${CUR_EXPECTED[$j]}" == "${CUR_VALUES[$j]}" ]]; then | ||
# echo "Values for index ${j} match: '${CUR_EXPECTED[$j]}' '${CUR_VALUES[$j]}'" | ||
# else | ||
# echo "Result value for index ${j}: '${CUR_EXPECTED[$j]}' doesn't match expected: '${CUR_VALUES[$j]}'" | ||
# exit 30 | ||
# fi | ||
# done | ||
#done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Testing Docker image | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
docker_testing: | ||
runs-on: ubuntu-latest | ||
name: Running Docker testing | ||
steps: | ||
- name: Fetch source code | ||
uses: actions/checkout@v2 | ||
- name: Create folders | ||
run: | | ||
mkdir ./inputs && chmod 777 ./inputs | ||
mkdir ./outputs && chmod 777 ./outputs | ||
- name: List folder contents | ||
run: | | ||
echo "Current folder" && ls -la | ||
echo "test_data" && ls -l ./test_data | ||
- name: Copy testing data files | ||
run: | | ||
cp "${PWD}/test_data"/* "${PWD}/inputs/" | ||
echo "inputs" && ls -l ./inputs | ||
- 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 greenness_test:latest ./ | ||
- name: Compress docker image | ||
run: docker save greenness_test:latest | gzip -7 -c - > greenness_test_image.tar.gz | ||
- name: Upload docker image | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: greenness_test_image | ||
path: greenness_test_image.tar.gz | ||
- name: Folder contents | ||
run: | | ||
echo "Current folder" && ls -l | ||
echo "Inputs folder" && ls -l ./inputs | ||
echo "Outputs folder" && ls -l ./outputs | ||
- name: Run docker test | ||
run: docker run --rm -v "${PWD}/inputs:/inputs" -v "${PWD}/outputs:/outputs" greenness_test:latest --working_space /outputs --metadata /inputs/experiment.yaml /inputs/rgb_1_2_E.tif | ||
- name: Output folder contents | ||
run: echo "Outputs folder" && ls -l ./outputs | ||
- name: Check outputs | ||
run: | | ||
cat "outputs/rgb_plot.csv" | ||
chmod +x "./.github/workflows/docker_test_check.sh" | ||
"./.github/workflows/docker_test_check.sh" | ||
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: greenness_test_image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.