From 35889e48c42d623dfc9b61829ab2cf245bb9997a Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Thu, 14 Jan 2021 18:07:27 -0500 Subject: [PATCH] ci: Early exit for doc changes --- .github/workflows/build-and-test.yml | 5 ++++- .github/workflows/formatting.yml | 2 +- scripts/ci/gh-actions/run.sh | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 51e6383630..c6f29446a5 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,4 +1,4 @@ -name: GitHub Actions +name: GitHub Actions (Build) on: push: @@ -19,6 +19,7 @@ jobs: env: GH_YML_JOBNAME: ${{ matrix.jobname }} GH_YML_OS: Linux + GH_SHA_BEFORE: ${{ github.event.before }} strategy: fail-fast: false @@ -73,6 +74,7 @@ jobs: env: GH_YML_JOBNAME: ${{ matrix.jobname }} GH_YML_OS: Linux + GH_SHA_BEFORE: ${{ github.event.before }} strategy: fail-fast: false @@ -117,6 +119,7 @@ jobs: env: GH_YML_JOBNAME: ${{ matrix.jobname }} GH_YML_OS: Linux + GH_SHA_BEFORE: ${{ github.event.before }} strategy: fail-fast: false diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index ffd13ae4c6..268149d257 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -1,4 +1,4 @@ -name: Formatting +name: GitHub Actions (Formatting) on: push: diff --git a/scripts/ci/gh-actions/run.sh b/scripts/ci/gh-actions/run.sh index c71f2be119..d3a850548e 100755 --- a/scripts/ci/gh-actions/run.sh +++ b/scripts/ci/gh-actions/run.sh @@ -1,5 +1,7 @@ #!/bin/bash --login +#set -x + if [[ "${GITHUB_JOB}" =~ emu ]] then export CI_SITE_NAME="GitHub Actions (QEMU)" @@ -82,6 +84,25 @@ echo "**********Env Begin**********" env | sort echo "**********Env End************" +echo "**********Doc Check Begin************" +if [ "${GITHUB_EVENT_NAME}" = "pull_request" ] +then + git fetch origin ${GITHUB_BASE_REF} + REF0=$(git merge-base origin/${GITHUB_BASE_REF} HEAD) +else + REF0=${GH_SHA_BEFORE} +fi +NFILES=$(git diff --name-only ${REF0}..HEAD | wc -l) +NNOTDOCS=$(git diff --name-only ${REF0}..HEAD | grep -v '^docs/' | wc -l) +echo "${NFILES} files changed, ${NNOTDOCS} not in docs/." +git diff --name-only ${REF0}..HEAD +if [ ${NFILES} -ne 0 -a ${NNOTDOCS} -eq 0 ] +then + echo "Only changes in docs/; skipping all other CI actions." + exit 0 +fi +echo "**********Doc Check End**************" + echo "**********CTest Begin**********" ${CTEST} --version echo ${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS}