Skip to content

Commit

Permalink
Skip tests if a pull request only changes documentation (apache#6182)
Browse files Browse the repository at this point in the history
Motivation

Currently github actions are marked as required. But github actions are skipped if the change only changes markdown files. So it is blocking merging documentation changes.

Modification

Add a github action to check if this pull request is a doc-only change or not. If it is a doc-only change, we can skip the checks.

* Skip tests if a pull requests only change the docs

* Change the workflows to run only when there are code changes

* add conditional check to ci-integration-process
  • Loading branch information
sijie authored Feb 1, 2020
1 parent d42cfa1 commit 6b04f6f
Show file tree
Hide file tree
Showing 21 changed files with 310 additions and 101 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,24 +31,36 @@ jobs:
timeout-minutes: 120

steps:

- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: build pacakge
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR package -DskipTests

- name: build cpp artifacts
if: steps.docs.outputs.changed_only == 'no'
run: |
echo "Build C++ client library"
export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_DYNAMIC_LIB=OFF"
pulsar-client-cpp/docker-build.sh
- name: run c++ tests
if: steps.docs.outputs.changed_only == 'no'
run: pulsar-client-cpp/docker-tests.sh


Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/ci-go-functions-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,38 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up Go 1.12
uses: actions/setup-go@v1
if: steps.docs.outputs.changed_only == 'no'
with:
go-version: 1.12
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: InstallTool
if: steps.docs.outputs.changed_only == 'no'
run: |
cd pulsar-function-go
wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.18.0
./bin/golangci-lint --version
- name: Build
if: steps.docs.outputs.changed_only == 'no'
run: |
cd pulsar-function-go
go build ./pf
- name: CheckStyle
if: steps.docs.outputs.changed_only == 'no'
run: |
cd pulsar-function-go
./bin/golangci-lint run -c ./golangci.yml ./pf
15 changes: 12 additions & 3 deletions .github/workflows/ci-go-functions-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,25 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up Go 1.12
uses: actions/setup-go@v1
if: steps.docs.outputs.changed_only == 'no'
with:
go-version: 1.12
id: go

- name: checkout
uses: actions/checkout@v1

- name: run tests
if: steps.docs.outputs.changed_only == 'no'
run: |
cd pulsar-function-go
go test -v $(go list ./... | grep -v examples)
22 changes: 17 additions & 5 deletions .github/workflows/ci-integration-backwards-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,28 +31,42 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
if: steps.docs.outputs.changed_only == 'no'
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: run install by skip tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn clean install -DskipTests

- name: build artifacts and docker image
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/docker-images/pom.xml install -am -Pdocker -DskipTests

- name: clean docker container
if: steps.docs.outputs.changed_only == 'no'
run: docker system prune -f

- name: remove docker node image
if: steps.docs.outputs.changed_only == 'no'
run: docker rmi -f node:10 && docker rmi -f node:12 && docker rmi -f buildpack-deps:stretch

- name: remove docker builder and microsoft image
if: steps.docs.outputs.changed_only == 'no'
run: docker rmi -f jekyll/builder:latest && docker rmi -f mcr.microsoft.com/azure-pipelines/node8-typescript:latest

- name: run integration tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-backwards-compatibility.xml -DintegrationTests -DredirectTestOutputToFile=false
18 changes: 13 additions & 5 deletions .github/workflows/ci-integration-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,16 +31,26 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: build artifacts and docker image
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B install -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR -Pdocker -DskipTests

- name: run integration tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-cli.xml -DintegrationTests -DredirectTestOutputToFile=false
18 changes: 13 additions & 5 deletions .github/workflows/ci-integration-function-state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,16 +31,26 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: build artifacts and docker image
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B install -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR -Pdocker -DskipTests

- name: run integration tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-function-state.xml -DintegrationTests -DredirectTestOutputToFile=false
18 changes: 13 additions & 5 deletions .github/workflows/ci-integration-messaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,16 +31,26 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: build artifacts and docker image
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B install -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR -Pdocker -DskipTests

- name: run integration tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-messaging.xml -DintegrationTests -DredirectTestOutputToFile=false
24 changes: 19 additions & 5 deletions .github/workflows/ci-integration-process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,34 +31,50 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: run install by skip tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn clean install -DskipTests

- name: build artifacts and docker image
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/docker-images/pom.xml install -am -Pdocker -DskipTests

- name: clean docker container
if: steps.docs.outputs.changed_only == 'no'
run: docker system prune -f

- name: remove docker node image
if: steps.docs.outputs.changed_only == 'no'
run: docker rmi -f node:10 && docker rmi -f node:12 && docker rmi -f buildpack-deps:stretch

- name: remove docker builder and microsoft image
if: steps.docs.outputs.changed_only == 'no'
run: docker rmi -f jekyll/builder:latest && docker rmi -f mcr.microsoft.com/azure-pipelines/node8-typescript:latest

- name: run integration function
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -DredirectTestOutputToFile=false -Dgroups=function

- name: run integration source
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -DredirectTestOutputToFile=false -Dgroups=source

- name: run integraion sink
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-process.xml -DintegrationTests -DredirectTestOutputToFile=false -Dgroups=sink
18 changes: 13 additions & 5 deletions .github/workflows/ci-integration-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:

Expand All @@ -33,16 +31,26 @@ jobs:
timeout-minutes: 120

steps:
- name: checkout
uses: actions/checkout@v1

- name: Check if this pull request only changes documentation
id: docs
# TODO: move this action to an apache repo
uses: sijie/pulsar-github-actions/diff-only@master
with:
args: site2 .github deployment

- name: Set up JDK 1.8
uses: actions/setup-java@v1
if: steps.docs.outputs.changed_only == 'no'
with:
java-version: 1.8

- name: checkout
uses: actions/checkout@v1

- name: build artifacts and docker image
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B install -Dorg.slf4j.simpleLogger.defaultLogLevel=ERROR -Pdocker -DskipTests

- name: run integration tests
if: steps.docs.outputs.changed_only == 'no'
run: mvn -B -f tests/pom.xml test -DintegrationTestSuiteFile=pulsar-schema.xml -DintegrationTests -DredirectTestOutputToFile=false
Loading

0 comments on commit 6b04f6f

Please sign in to comment.