Skip CI in some cases to save resources (#6340)

This commit is contained in:
Zhenxu Ke 2021-02-07 16:19:55 +08:00 committed by GitHub
parent ba6d49ad91
commit 30a88b555f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 203 additions and 6 deletions

View File

@ -43,7 +43,7 @@ runs:
shell: bash
run: |
echo "::group::Add checkstyle plugin to the pom.xml"
sed -i "/<\/sourceDirectories>/i <sourceDirectory>scenarios\/""${{ matrix.case }}""<\/sourceDirectory>" test/plugin/pom.xml
sed -i "/<\/sourceDirectories>/i <sourceDirectory>scenarios\/""${{ inputs.test_case }}""<\/sourceDirectory>" test/plugin/pom.xml
echo "::endgroup::"
- name: Build SkyWalking Agent
shell: bash

76
.github/actions/skip/action.yml vendored Normal file
View File

@ -0,0 +1,76 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: "Set Skip Env Var"
description: "Action to set the SKIP_CI environment variable indicating that we should skip CI jobs"
inputs:
paths:
description: >-
Set the SKIP_CI environment variable when and only when all the changed files located in one of the path,
the paths is shell-style pattern.
required: false
default: >-
"*.md"
"skywalking-ui"
runs:
using: "composite"
steps:
- name: Check Changed Files And Set Env Var
shell: bash
run: |
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
exit 0
fi
BASE_SHA=$(jq -r '.pull_request.base.sha' $GITHUB_EVENT_PATH)
echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA"
git fetch --no-tags --progress --recurse-submodules --depth=1 origin ${BASE_SHA}:origin/${BASE_SHA}
BASE_SHA=origin/${BASE_SHA}
echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA"
if ! files=$(git --no-pager diff --name-only ${GITHUB_SHA} ${BASE_SHA}); then
exit 1
fi
echo "Ignore pattern:"
for pattern in $(echo '${{ inputs.paths }}'); do
echo $pattern
done
echo "Changed files:"
for file in ${files}; do
echo $file
done
echo "SKIP_CI=true" >> $GITHUB_ENV
for file in ${files}; do
matched=0
for pattern in $(echo '${{ inputs.paths }}'); do
pattern=$(echo "$pattern" | sed 's/"//g')
if eval "[[ '$file' == $pattern ]]"; then
matched=1
break
fi
done
if [[ "$matched" == "0" ]]; then
echo "$file doesn't match pattern $(echo '${{ inputs.paths }}'), stop checking"
echo "SKIP_CI=false" >> $GITHUB_ENV
break
fi
done

View File

@ -33,11 +33,15 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Check License Header
if: env.SKIP_CI != 'true'
uses: apache/skywalking-eyes@9bd5feb86b5817aa6072b008f9866a2c3bbc8587
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -45,15 +49,19 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v1
if: env.SKIP_CI != 'true'
with:
java-version: 8
- name: 'Check Javaagent Plugin List'
if: env.SKIP_CI != 'true'
run: tools/plugin/check-javaagent-plugin-list.sh
- name: 'Install & Test'
if: env.SKIP_CI != 'true'
run: |
./mvnw --batch-mode -P"agent,backend,ui,dist,CI-with-IT" clean cobertura:cobertura verify install javadoc:javadoc
bash <(curl -s https://codecov.io/bash)
- name: 'Check Dependencies Licenses'
if: env.SKIP_CI != 'true'
run: tools/dependencies/check-LICENSE.sh
CI-on-JDK11:
@ -63,9 +71,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Check License Header
if: env.SKIP_CI != 'true'
uses: apache/skywalking-eyes@9bd5feb86b5817aa6072b008f9866a2c3bbc8587
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -73,9 +85,11 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v1
if: env.SKIP_CI != 'true'
with:
java-version: 11
- name: 'Install & Test'
if: env.SKIP_CI != 'true'
run: ./mvnw --batch-mode -P"agent,backend,ui,dist" clean verify install
CI-on-Windows:
@ -85,10 +99,14 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- uses: actions/setup-java@v1
if: env.SKIP_CI != 'true'
with:
java-version: 8
- name: 'Install & Test'
if: env.SKIP_CI != 'true'
run: ./mvnw --batch-mode -P"agent,backend,ui,dist" clean verify install
@ -99,7 +117,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -107,9 +128,11 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v1
if: env.SKIP_CI != 'true'
with:
java-version: 8
- name: 'Install & Test'
if: env.SKIP_CI != 'true'
run: |
# Given packaging on Mac has a high possibility to fail, we retry one more time here
./mvnw --batch-mode -P"agent,backend,ui,dist" clean verify install || \

View File

@ -40,7 +40,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -48,6 +51,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.ClusterE2E

View File

@ -34,7 +34,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -42,10 +45,12 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set Up Java
if: env.SKIP_CI != 'true'
uses: actions/setup-java@v1
with:
java-version: 11
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.simple.SimpleE2E

View File

@ -40,7 +40,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -48,6 +51,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.event.EventE2E

View File

@ -36,7 +36,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -44,6 +47,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.GOE2E

View File

@ -48,25 +48,34 @@ jobs:
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- uses: actions/cache@v2
if: env.SKIP_CI != 'true'
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Build Docker Image
if: env.SKIP_CI != 'true'
run: make docker
- name: Prepare envrionment
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/pre.sh
- name: Install Minikube
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/minikube.sh start
- name: Install Istio
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/istio.sh --set profile=demo --set meshConfig.defaultConfig.envoyAccessLogService.address=skywalking-oap.istio-system:11800 --set meshConfig.enableEnvoyAccessLogService=true
- name: Install SkyWalking
if: env.SKIP_CI != 'true'
run: |
git clone https://github.com/apache/skywalking-kubernetes.git
cd skywalking-kubernetes
@ -96,6 +105,7 @@ jobs:
kubectl get services -A -o wide
- name: Deploy demo services
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/demo.sh
- name: Cluster Info
@ -106,6 +116,7 @@ jobs:
minikube status
- name: Set up Minikube tunnel
if: env.SKIP_CI != 'true'
run: |
mkdir /tmp/minikube-tunnel
minikube tunnel > /tmp/minikube-tunnel/a.log &
@ -114,6 +125,7 @@ jobs:
kubectl -n istio-system port-forward $POD_NAME 8080:8080 > /tmp/minikube-tunnel/b.log &
- name: Run E2E test
if: env.SKIP_CI != 'true'
run: |
export GATEWAY_HOST=$(minikube ip)
export GATEWAY_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
@ -124,13 +136,15 @@ jobs:
- name: Logs
if: ${{ failure() }}
continue-on-error: true
run: |
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=ui"
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=oap"
cat /tmp/minikube-tunnel/*
- name: Clean up
if: ${{ always() }}
if: env.SKIP_CI != 'true'
continue-on-error: true
run: minikube delete
metrics-service:
@ -148,22 +162,30 @@ jobs:
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- uses: actions/cache@v2
if: env.SKIP_CI != 'true'
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Build Docker Image
if: env.SKIP_CI != 'true'
run: make docker
- name: Prepare envrionment
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/pre.sh
- name: Install Minikube
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/minikube.sh start
- name: Install Istio
if: env.SKIP_CI != 'true'
run: |
bash ${SCRIPTS_DIR}/istio.sh \
--set profile=demo \
@ -171,6 +193,7 @@ jobs:
--set values.telemetry.v2.enabled=false # disable the metadata-exchange extension intentionally to make sure metrics service doesn't rely on it
- name: Install SkyWalking
if: env.SKIP_CI != 'true'
run: |
git clone https://github.com/apache/skywalking-kubernetes.git
cd skywalking-kubernetes
@ -196,6 +219,7 @@ jobs:
kubectl get services -A -o wide
- name: Deploy demo services
if: env.SKIP_CI != 'true'
run: bash ${SCRIPTS_DIR}/demo.sh
- name: Cluster Info
@ -206,6 +230,7 @@ jobs:
minikube status
- name: Set up Minikube tunnel
if: env.SKIP_CI != 'true'
run: |
mkdir /tmp/minikube-tunnel
minikube tunnel > /tmp/minikube-tunnel/a.log &
@ -214,6 +239,7 @@ jobs:
kubectl -n istio-system port-forward $POD_NAME 8080:8080 > /tmp/minikube-tunnel/b.log &
- name: Run E2E test
if: env.SKIP_CI != 'true'
run: |
export GATEWAY_HOST=$(minikube ip)
export GATEWAY_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
@ -224,11 +250,12 @@ jobs:
- name: Logs
if: ${{ failure() }}
continue-on-error: true
run: |
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=ui"
kubectl -n istio-system logs --tail=10000 -l "app=skywalking,release=skywalking,component=oap"
cat /tmp/minikube-tunnel/*
- name: Clean up
if: ${{ always() }}
if: env.SKIP_CI != 'true'
run: minikube delete

View File

@ -37,7 +37,11 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
depth: 0
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -45,10 +49,12 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Set Up Java
if: env.SKIP_CI != 'true'
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.simple.SimpleE2E

View File

@ -40,7 +40,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -48,6 +51,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.browser.BrowserE2E

View File

@ -48,7 +48,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -56,6 +59,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: ${{ matrix.case.class }}

View File

@ -40,7 +40,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -48,6 +51,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.log.LogE2E

View File

@ -36,7 +36,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -44,6 +47,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.NodeJSE2E

View File

@ -33,7 +33,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -41,6 +44,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.PHPE2E

View File

@ -41,7 +41,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -49,6 +52,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.profile.ProfileE2E

View File

@ -36,7 +36,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -44,6 +47,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.PythonE2E

View File

@ -36,7 +36,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -44,6 +47,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.SO11yE2E

View File

@ -38,7 +38,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -46,6 +49,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.storage.StorageE2E

View File

@ -41,7 +41,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -49,6 +52,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.ttl.StorageTTLE2E

View File

@ -42,7 +42,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -50,6 +53,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: org.apache.skywalking.e2e.simple.SimpleE2E
@ -78,7 +82,10 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set Skip Env Var
uses: ./.github/actions/skip
- name: Cache local Maven repository
if: env.SKIP_CI != 'true'
uses: actions/cache@v2
with:
path: ~/.m2/repository
@ -86,6 +93,7 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Run E2E Test
if: env.SKIP_CI != 'true'
uses: ./.github/actions/e2e-test
with:
test_class: ${{ matrix.case.class }}

View File

@ -34,7 +34,7 @@
<artifactId>e2e-service-provider</artifactId>
<properties>
<sw.snapshot.version>8.4.0-SNAPSHOT</sw.snapshot.version>
<sw.version>8.4.0</sw.version>
</properties>
<dependencies>
@ -60,12 +60,12 @@
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>${sw.snapshot.version}</version>
<version>${sw.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>${sw.snapshot.version}</version>
<version>${sw.version}</version>
</dependency>
</dependencies>