Skip to content

Commit

Permalink
ci: skip server tests in PRs if there are no server changes (hasura#4412
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rikinsk authored Apr 17, 2020
1 parent bf719cb commit 3c9d1f2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ refs:
else
echo "no skip_job file present, full steam ahead"
fi
skip_server_tests: &skip_server_tests
run:
name: checking if server tests can be skipped
command: |
echo "PR number: $CIRCLE_PR_NUMBER"
if [ -z "$CIRCLE_PR_NUMBER" ]; then
echo "Not a PR build, continuing test" && exit 0
fi
echo "Compare refs: ${CIRCLE_COMPARE_URL##http*/}"
if git diff --quiet "${CIRCLE_COMPARE_URL##http*/}" -- server; then
echo "No server changes present, skipping test"
circleci-agent step halt
else
echo "Server changes present, continuing test"
fi
wait_for_postgres: &wait_for_postgres
run:
name: waiting for postgres to be ready
Expand Down Expand Up @@ -79,6 +94,7 @@ refs:
at: /build
- *skip_job_on_ciignore
- checkout
- *skip_server_tests
- *wait_for_postgres
- run:
name: Install deps
Expand Down Expand Up @@ -274,6 +290,7 @@ jobs:
at: /build
- *skip_job_on_ciignore
- checkout
- *skip_server_tests
- run:
name: Run unit tests
environment:
Expand Down Expand Up @@ -532,6 +549,7 @@ jobs:
at: /build
- *skip_job_on_ciignore
- checkout
- *skip_server_tests
- run:
name: install_necessary_packages
command: |
Expand Down

0 comments on commit 3c9d1f2

Please sign in to comment.