Skip to content

Commit

Permalink
Split CI into smaller pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
James McClain committed Aug 29, 2023
1 parent 63afa03 commit bfd05a9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ jobs:

- run: ./scripts/cibuild

- run: docker system prune -f

- run: ./scripts/test "style_tests"

- run: ./scripts/test "unit_tests"

- run: ./scripts/test "integration_tests"

- run: ./scripts/test "coverage"

- uses: codecov/codecov-action@v2
2 changes: 0 additions & 2 deletions scripts/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
--cache-from=quay.io/azavea/raster-vision:pytorch-latest \
-t "raster-vision-${IMAGE_TYPE}" \
-f Dockerfile .

./scripts/test
fi
fi
63 changes: 38 additions & 25 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,52 @@ fi

function usage() {
echo -n \
"Usage: $(basename "$0")
Run linters and tests.
"Usage: $(basename "$0") [style_tests|unit_tests|integration_tests|coverage]
Run linters and tests based on the provided argument.
"
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
if [[ "${1:-}" == "--help" ]]; then
usage
else
if [[ -n "${CI}" ]]; then
# Execute test suites
docker run \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
/opt/src/scripts/style_tests
docker run \
-w "/opt/src" \
-v "$(pwd):/opt/src" \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
/opt/src/scripts/unit_tests
docker run \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
/opt/src/scripts/integration_tests
COMMAND=${1:-"all"}

# Create new coverage reports
docker run \
-w "/opt/src" \
-v "$(pwd):/opt/src" \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
coverage xml
if [[ -n "${CI}" ]]; then
case $COMMAND in
"style_tests")
docker run \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
/opt/src/scripts/style_tests
;;
"unit_tests")
docker run \
-w "/opt/src" \
-v "$(pwd):/opt/src" \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
/opt/src/scripts/unit_tests
;;
"integration_tests")
docker run \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
/opt/src/scripts/integration_tests
;;
"coverage")
docker run \
-w "/opt/src" \
-v "$(pwd):/opt/src" \
--rm -t \
"raster-vision-${IMAGE_TYPE}" \
coverage xml
;;
*)
echo "Invalid argument. Run --help for usage."
exit 1
;;
esac
else
# Local test suite runs against pytorch image by default
IMAGE_TYPE=${IMAGE_TYPE:-pytorch}
Expand Down

0 comments on commit bfd05a9

Please sign in to comment.