Enhance CI skipping strategy (#8982)

This commit is contained in:
Superskyyy 2022-05-04 00:48:29 -04:00 committed by GitHub
parent 054e01a6b1
commit 00363a02a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 116 additions and 115 deletions

View File

@ -41,7 +41,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true

View File

@ -18,6 +18,8 @@ name: Dead Link Checker
on:
pull_request:
schedule:
- cron: '0 18 * * *' # TimeZone: UTC 0
concurrency:
group: dlc-${{ github.event.pull_request.number || github.ref }}
@ -25,10 +27,11 @@ concurrency:
jobs:
CheckDeadLinks:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: sudo npm install -g markdown-link-check@3.10.0
- run: |
for file in $(find . -name "*.md"); do

View File

@ -39,7 +39,7 @@ jobs:
env:
TAG: ${{ github.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache local Maven repository

View File

@ -36,7 +36,7 @@ jobs:
env:
TAG: ${{ github.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache local Maven repository

View File

@ -1,45 +0,0 @@
# 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: CI
on:
pull_request:
paths-ignore:
- "**"
- "!**/*.md"
- "!**/*.txt"
- "!skywalking-ui"
- "!.asf.yaml"
- "!.dlc.yaml"
- "!.licenserc.yaml"
- "!docs/menu.yml"
- "!.github/workflows/codeql.yaml"
- "!dist-material/release-docs"
- "!**/component-libraries.yml"
concurrency:
group: skywalking-fake-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
required:
name: Required
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Merge Requirement
run: echo 'Passed!'

View File

@ -18,17 +18,6 @@ name: CI
on:
pull_request:
paths-ignore:
- "**.md"
- "**.txt"
- "skywalking-ui"
- ".asf.yaml"
- ".dlc.yaml"
- ".licenserc.yaml"
- "docs/menu.yml"
- ".github/workflows/codeql.yaml"
- "dist-material/release-docs"
- "**/component-libraries.yml"
schedule:
- cron: '0 18 * * *' # TimeZone: UTC 0
@ -51,7 +40,7 @@ jobs:
with:
submodules: true
- name: Check license header
uses: apache/skywalking-eyes@831233e32ab3a2fbc28fe934f4983c4edae6e722
uses: apache/skywalking-eyes@985866ce7e324454f61e22eb2db2e998db09d6f3
code-style:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
@ -74,17 +63,53 @@ jobs:
steps:
- name: Check results
run: |
if [[ ${{ needs.license-header.result }} != 'success' ]]; then
exit -1
fi
if [[ ${{ needs.code-style.result }} != 'success' ]]; then
exit -1
fi
[[ ${{ needs.license-header.result }} == 'success' ]] || exit -1;
[[ ${{ needs.code-style.result }} == 'success' ]] || exit -1;
changes:
# Check if anything related to Actual code / CI(functional testing) is changed
# set outputs for other jobs to access for if conditions
runs-on: ubuntu-latest
needs: [ sanity-check ]
# To prevent error when there's no base branch
if: github.event_name != 'schedule'
timeout-minutes: 10
outputs:
oap: ${{ steps.filter.outputs.oap }}
steps:
- uses: actions/checkout@v3 # required for push event
- name: Check for file changes
uses: getsentry/paths-filter@v2
id: filter
with:
token: ${{ github.token }}
# The following is a single composite pattern that allows next CI steps,
# the pattern is in form of [not (foo or bar)] to be safe.
# When new files come in, the CI will NOT ignore them unless listed,
# so remember to extend here if they do not serve functional purposes.
# NOTE: careful with using ** in expression, keep !**/{old, new things}.
filters: |
oap:
- "!**/{\
*.md,*.txt,\
skywalking-ui,\
.asf.yaml,.dlc.json,.gitignore,.licenserc.yaml,\
codeStyle.xml,\
HEADER,LICENSE,NOTICE,\
docs/**,\
.github/workflows/codeql.yaml,\
.github/(ISSUE_TEMPLATE/**|PULL_REQUEST_TEMPLATE),\
dist-material/release-docs/*,\
component-libraries.yml\
}"
list-files: json # logs matched files
dist-tar:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: Build dist tar
needs: [ sanity-check ]
needs: [ sanity-check, changes ]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@ -102,16 +127,18 @@ jobs:
-Dmaven.test.skip \
-Dmaven.javadoc.skip \
-Dcheckstyle.skip
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
name: Upload distribution tar
with:
name: dist
path: dist
docker:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: Docker images
needs: [ dist-tar ]
needs: [ dist-tar, changes ]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
@ -121,13 +148,13 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
name: Download distribution tar
with:
name: dist
path: dist
- name: Set up Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
@ -139,15 +166,17 @@ jobs:
docker save -o docker-images-skywalking-oap.tar skywalking/oap:latest
docker save -o docker-images-skywalking-ui.tar skywalking/ui:latest
- name: Upload docker images
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: docker-images-${{ matrix.java-version }}
path: docker-images-skywalking-*.tar
dependency-license:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: Dependency licenses
needs: [ dist-tar ]
needs: [ dist-tar, changes ]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
@ -159,7 +188,7 @@ jobs:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
@ -167,9 +196,11 @@ jobs:
run: tools/dependencies/check-LICENSE.sh
unit-test:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: Unit test
needs: [ sanity-check ]
needs: [ sanity-check, changes ]
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
strategy:
@ -184,12 +215,12 @@ jobs:
with:
submodules: true
- name: Cache maven repository
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: adopt
@ -197,9 +228,11 @@ jobs:
run: ./mvnw clean verify -q -B -D"checkstyle.skip" || ./mvnw clean verify -q -B -D"checkstyle.skip"
integration-test:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: Integration test
needs: [ sanity-check ]
needs: [ sanity-check, changes ]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
@ -210,12 +243,12 @@ jobs:
with:
submodules: true
- name: Cache maven repository
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: adopt
@ -225,7 +258,9 @@ jobs:
./mvnw clean verify -q -B -Dcheckstyle.skip -DskipUTs -DskipITs=false
e2e-test:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: E2E test
needs: [ docker ]
runs-on: ubuntu-latest
@ -459,7 +494,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
name: Download docker images
with:
name: docker-images-8
@ -470,7 +505,7 @@ jobs:
shell: bash
run: ./mvnw -B -f test/e2e-v2/java-test-service/pom.xml clean package
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.16'
- name: Set env var
@ -482,7 +517,9 @@ jobs:
e2e-file: $GITHUB_WORKSPACE/${{ matrix.test.config }}
e2e-test-istio:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: E2E test
needs: [ docker ]
runs-on: ubuntu-latest
@ -496,7 +533,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
name: Download docker images
with:
name: docker-images-8
@ -504,7 +541,7 @@ jobs:
- name: Load docker images
run: find docker-images -name "*.tar" -exec docker load -i {} \;
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.16'
- name: ${{ matrix.test.name }}
@ -516,7 +553,9 @@ jobs:
e2e-file: $GITHUB_WORKSPACE/test/e2e-v2/cases/istio/als/e2e.yaml
e2e-test-java-versions:
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking') || (github.event_name != 'schedule')
if: |
always() &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking') || needs.changes.outputs.oap == 'true')
name: E2E test
needs: [ docker ]
runs-on: ubuntu-latest
@ -529,14 +568,14 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
name: Download docker images
with:
name: docker-images-${{ matrix.java-version }}
path: docker-images
- name: Load docker images
run: find docker-images -name "*.tar" -exec docker load -i {} \;
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: adopt
@ -544,7 +583,7 @@ jobs:
shell: bash
run: ./mvnw -B -f test/e2e-v2/java-test-service/pom.xml clean package
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.16'
- name: Java version ${{ matrix.java-version }}
@ -568,22 +607,26 @@ jobs:
timeout-minutes: 10
steps:
- name: Merge Requirement
# check changes, sanity, dependency license, unit, integration, e2e, e2e-istio and e2e-java-versions,
# if all of them are working as expected then naturally exits else return error code
run: |
if [[ ${{ needs.dependency-license.result }} != 'success' ]]; then
exit -1
fi
if [[ ${{ needs.unit-test.result }} != 'success' ]]; then
exit -1
fi
if [[ ${{ needs.integration-test.result }} != 'success' ]]; then
exit -1
fi
if [[ ${{ needs.e2e-test.result }} != 'success' ]]; then
exit -1
fi
if [[ ${{ needs.e2e-test-istio.result }} != 'success' ]]; then
exit -1
fi
if [[ ${{ needs.e2e-test-java-versions.result }} != 'success' ]]; then
exit -1
fi
execute=${{ needs.changes.outputs.oap }}
sanityResults=${{ needs.dependency-license.result }}
[[ ${sanityResults} == 'success' ]] || [[ ${execute} != 'true' && ${sanityResults} == 'skipped' ]] || exit -1;
depLicenseResults=${{ needs.dependency-license.result }}
unitResults=${{ needs.unit-test.result }};
integrationResults=${{ needs.integration-test.result }};
e2eResults=${{ needs.e2e-test.result }};
e2eIstioResults=${{ needs.e2e-test-istio.result }};
e2eJavaVersionResults=${{ needs.e2e-test-java-versions.result }};
[[ ${depLicenseResults} == 'success' ]] || [[ ${execute} != 'true' && ${depLicenseResults} == 'skipped' ]] || exit -2;
[[ ${unitResults} == 'success' ]] || [[ ${execute} != 'true' && ${unitResults} == 'skipped' ]] || exit -3;
[[ ${integrationResults} == 'success' ]] || [[ ${execute} != 'true' && ${integrationResults} == 'skipped' ]] || exit -4;
[[ ${e2eResults} == 'success' ]] || [[ ${execute} != 'true' && ${e2eResults} == 'skipped' ]] || exit -5;
[[ ${e2eIstioResults} == 'success' ]] || [[ ${execute} != 'true' && ${e2eIstioResults} == 'skipped' ]] || exit -6;
[[ ${e2eJavaVersionResults} == 'success' ]] || [[ ${execute} != 'true' && ${e2eJavaVersionResults} == 'skipped' ]] || exit -7;
exit 0;