Skip to content

feat(failinject): add failinject feature #3923

feat(failinject): add failinject feature

feat(failinject): add failinject feature #3923

#
# 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:
push:
pull_request:
pull_request_target:
jobs:
license-check:
name: License Check - Go ${{ matrix.go_version }}
runs-on: ubuntu-latest
strategy:
matrix:
go_version:
- 1.18
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Check License Header
uses: apache/skywalking-eyes/header@501a28d2fb4a9b962661987e50cf0219631b32ff
go-fmt:
name: Go fmt ${{ matrix.os }} - Go ${{ matrix.go_version }}
runs-on: ${{ matrix.os }}
strategy:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- 1.18
os:
- ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
# Cache
path: ~/go/pkg/mod
# Cache key
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-go-
- name: Merge base
if: ${{ github.event_name == 'pull_request' }}
run: |
git fetch origin develop
git checkout -b develop origin/develop
git remote add devrepo https://github.com/${{github.event.pull_request.head.repo.full_name}}.git
git fetch devrepo ${{github.event.pull_request.head.sha}}
git config --global user.email "dubbo-go@github-ci.com"
git config --global user.name "robot"
git merge ${{github.event.pull_request.head.sha}}
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
- name: Go Fmt
run: |
go fmt ./... && git status && [[ -z `git status -s` ]]
# diff -u <(echo -n) <(gofmt -d -s .)
lint:
name: Lint ${{ matrix.os }} - Go ${{ matrix.go_version }}
runs-on: ${{ matrix.os }}
strategy:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- 1.18
os:
- ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
# Cache
path: ~/go/pkg/mod
# Cache key
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-go-
- name: Merge base
if: ${{ github.event_name == 'pull_request' }}
run: |
git fetch origin develop
git checkout -b develop origin/develop
git remote add devrepo https://github.com/${{github.event.pull_request.head.repo.full_name}}.git
git fetch devrepo ${{github.event.pull_request.head.sha}}
git config --global user.email "dubbo-go@github-ci.com"
git config --global user.name "robot"
git merge ${{github.event.pull_request.head.sha}}
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
- name: Install go ci lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.48.0
- name: Run Linter
run: GO111MODULE=on golangci-lint run --timeout=30m -v --disable-all --enable=govet --enable=staticcheck --enable=ineffassign --enable=misspell
go-test:
name: Go Test ${{ matrix.os }} - Go ${{ matrix.go_version }}
runs-on: ${{ matrix.os }}
strategy:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- 1.18
os:
- ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
# Cache
path: ~/go/pkg/mod
# Cache key
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-go-
- name: Merge base
if: ${{ github.event_name == 'pull_request' }}
run: |
git fetch origin develop
git checkout -b develop origin/develop
git remote add devrepo https://github.com/${{github.event.pull_request.head.repo.full_name}}.git
git fetch devrepo ${{github.event.pull_request.head.sha}}
git config --global user.email "dubbo-go@github-ci.com"
git config --global user.name "robot"
git merge ${{github.event.pull_request.head.sha}}
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
- name: Go Test
run: |
chmod u+x before_ut.sh && ./before_ut.sh
go mod vendor && go test ./... -gcflags=-l -coverprofile=coverage.txt -covermode=atomic
- name: Coverage
run: bash <(curl -s https://codecov.io/bash)
integrate-test:
name: Integrate Test - ${{ matrix.os }} - Go ${{ matrix.go_version }}
runs-on: ${{ matrix.os }}
strategy:
# If you want to matrix build , you can append the following list.
matrix:
go_version:
- 1.18
os:
- ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
# Cache
path: ~/go/pkg/mod
# Cache key
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-go-
- name: Merge base
if: ${{ github.event_name == 'pull_request' }}
run: |
git fetch origin develop
git checkout -b develop origin/develop
git remote add devrepo https://github.com/${{github.event.pull_request.head.repo.full_name}}.git
git fetch devrepo ${{github.event.pull_request.head.sha}}
git config --global user.email "dubbo-go@github-ci.com"
git config --global user.name "robot"
git merge ${{github.event.pull_request.head.sha}}
- name: Get dependencies
run: |
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
go get -v -t -d ./...
fi
# integration test
# This step only runs when the event type is a pull_request
- name: Integrate Test
if: ${{ github.event_name == 'pull_request' }}
run: |
chmod +x start_integrate_test.sh && [[ -n "${{github.event.pull_request.head.repo.full_name}}" ]] && [[ -n "${{github.event.pull_request.head.sha}}" ]] && [[ -n "${{github.base_ref}}" ]] && ./start_integrate_test.sh ${{github.event.pull_request.head.repo.full_name}} ${{github.event.pull_request.head.sha}} ${{github.base_ref}}
# This step only runs when the event type is a push
- name: Integrate Test
if: ${{ github.event_name == 'push' }}
run: |
chmod +x start_integrate_test.sh && ./start_integrate_test.sh $GITHUB_REPOSITORY $GITHUB_SHA $GITHUB_BASE_REF