Skip to content

fix: restore go.sum for generated CLI projects (#3589) #1

fix: restore go.sum for generated CLI projects (#3589)

fix: restore go.sum for generated CLI projects (#3589) #1

name: CI
on:
push:
branches:
- main
- 'release-*'
- 'feature-*'
pull_request:
branches: "*"
permissions:
contents: read
jobs:
license:
name: Check License Header
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Check License Header
uses: apache/skywalking-eyes/header@main #NOSONAR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config: .licenserc.yaml
mode: check
CI:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Cache dependencies
# ref: https://github.com/actions/cache/blob/main/examples.md#go---module
uses: actions/cache@v6
with:
# Cache, works only on Linux
path: |
~/.cache/go-build
~/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: Install generated-project toolchain
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
go install -mod=readonly google.golang.org/protobuf/cmd/protoc-gen-go
cd tools/protoc-gen-go-triple
go install .
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Test generated CLI projects
run: make -C tools/dubbogo-cli test-generated-projects
- name: Check Code Format
run: make check-fmt
- name: Unit Test
run: make test
- name: Lint
run: make lint
- name: Codecov
uses: codecov/codecov-action@v7 #NOSONAR
with:
fail_ci_if_error: true # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)
Integration-Test:
name: Integration Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Cache dependencies
# ref: https://github.com/actions/cache/blob/main/examples.md#go---module
uses: actions/cache@v6
with:
# Cache, works only on Linux
path: |
~/.cache/go-build
~/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: Integration Test
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
./integrate_test.sh ${{github.event.pull_request.head.repo.full_name}} ${{github.event.pull_request.head.sha}} main
elif [ "$GITHUB_EVENT_NAME" == "push" ]; then
./integrate_test.sh $GITHUB_REPOSITORY $GITHUB_SHA $GITHUB_REF_NAME
else
echo "$GITHUB_EVENT_NAME is an unsupported event type."
exit 1
fi