Skip to content

Commit

Permalink
Don't build buildkite/circleci tests on docs pushes (ddev#3469)
Browse files Browse the repository at this point in the history
* Don't build buildkite tests on docs pushes
* Don't build circleci tests on docs pushes
* Skip some builds on github too
* Skip on pr build as well
  • Loading branch information
rfay authored Dec 26, 2021
1 parent 4a85b88 commit 7d2f0f6
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 13 deletions.
13 changes: 5 additions & 8 deletions .buildkite/test.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/bash
# This script is used to build drud/ddev using buildkite

# Use docker-compose v2 on WSL2 to make sure we get testing on it
if [ ! -z "${WSL_DISTRO_NAME:-}" ]; then
docker-compose enable-v2
else
docker-compose disable-v2
# If this is a PR and the diff doesn't have code, skip it
if [ "${BUILDKITE_PULL_REQUEST}" != "" ] && ! git diff --name-only refs/remotes/origin/$BUILDKITE_PULL_REQUEST_BASE_BRANCH | egrep "^(Makefile|pkg|cmd|vendor|go\.)"; then
echo "Skipping build since no code changes found"
exit 0
fi

export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin

echo "buildkite building ${BUILDKITE_JOB_ID:-} at $(date) on $(hostname) as USER=${USER} for OS=${OSTYPE} in ${PWD} with golang=$(go version | awk '{print $3}') docker-desktop=$(scripts/docker-desktop-version.sh) docker=$(docker --version | awk '{print $3}') and $(docker-compose --version) ddev version=$(ddev --version | awk '{print $3}'))"
echo "buildkite building ${BUILDKITE_JOB_ID:-} at $(date) on $(hostname) as USER=${USER} for OS=${OSTYPE} in ${PWD} with golang=$(go version | awk '{print $3}') docker-desktop=$(scripts/docker-desktop-version.sh) docker=$(docker --version | awk '{print $3}') ddev version=$(ddev --version | awk '{print $3}'))"

export GOTEST_SHORT=1
export DDEV_NONINTERACTIVE=true
Expand Down Expand Up @@ -83,5 +81,4 @@ RV=$?
echo "test.sh completed with status=$RV"
ddev poweroff || true

docker-compose disable-v2
exit $RV
27 changes: 26 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 2.1
jobs:
build:
machine:
Expand Down Expand Up @@ -44,6 +44,20 @@ jobs:
DDEV_NONINTERACTIVE: "true"
steps:
- checkout

# If this is a PR and the diff doesn't have code, skip it
- run:
name: "Skip if no code changes"
command: |
set -x
if [ "${CIRCLE_PR_NUMBER}" != "" ] ; then
echo "base_revision=<< pipeline.git.base_revision >>"
if ! git diff --name-only "<< pipeline.git.base_revision >>" | egrep "^(Makefile|pkg|cmd|vendor|go\.)"; then
echo "Skipping build since no code changes found"
circleci-agent step halt
fi
fi
- attach_workspace:
at: ~/
- run: sudo mkdir /home/linuxbrew && sudo chown $(id -u) /home/linuxbrew
Expand Down Expand Up @@ -86,6 +100,17 @@ jobs:
DDEV_TEST_USE_MUTAGEN: ""
steps:
- checkout
- run:
name: "Skip if no code changes"
command: |
set -x
if [ "${CIRCLE_PR_NUMBER}" != "" ] ; then
echo "base_revision=<< pipeline.git.base_revision >>"
if ! git diff --name-only "<< pipeline.git.base_revision >>" | egrep "^(Makefile|pkg|cmd|vendor|go\.)"; then
echo "Skipping build since no code changes found"
circleci-agent step halt
fi
fi
- run:
command: ./.ci-scripts/linux_arm64_setup.sh
name: ARM64 VM setup
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/container-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ defaults:

on:
push:
branches: [ master ]
branches: [ master, main ]
pull_request:
branches: [ master ]
branches: [ master, main ]
# Only run when something changes in the actual containers
paths:
- "containers/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docscheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- master
- main
pull_request:
paths:
- "docs/**"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defaults:
shell: bash
on:
push:
branches: [ master ]
branches: [ master, main ]
release:
types: [ created ]

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ defaults:

on:
pull_request:
paths:
- "go.*"
- "pkg"
- "cmd"
- "Makefile"
- "vendor"

env:
BUILDKIT_PROGRESS: plain
DOCKER_CLI_EXPERIMENTAL: enabled
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Tests
on:
pull_request:
paths:
- "go.*"
- "pkg/**"
- "cmd/**"
- "Makefile"
- "vendor/**"
push:
branches: [ master ]
branches: [ master, main ]

defaults:
run:
Expand Down

0 comments on commit 7d2f0f6

Please sign in to comment.