Skip to content

Commit

Permalink
ci: adjust some actions and remove useless submodules (arana-db#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeffcaii authored Mar 31, 2022
1 parent 29eb969 commit b68979d
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 93 deletions.
1 change: 0 additions & 1 deletion .github/actions/actions-ding
Submodule actions-ding deleted from 356fb6
1 change: 0 additions & 1 deletion .github/actions/review-dog
Submodule review-dog deleted from cf69c4
81 changes: 6 additions & 75 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ name: CI

on:
push:
branches: [ master, develop ]
branches:
- master
pull_request:
branches: "*"
branches:
- master
pull_request_target:
branches: "*"
branches:
- master

jobs:

build:
name: ${{ matrix.os }} - Go ${{ matrix.go_version }}
runs-on: ${{ matrix.os }}
Expand All @@ -37,17 +39,10 @@ jobs:
matrix:
go_version:
- 1.16

os:
- ubuntu-latest

# https://docs.github.com/cn/actions/reference/encrypted-secrets
env:
DING_TOKEN: ${{ secrets.PROXY_DING_TOKEN }}
DING_SIGN: ${{ secrets.PROXY_DING_SIGN }}

steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
Expand All @@ -57,11 +52,6 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Check License Header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cache dependencies
uses: actions/cache@v2
with:
Expand All @@ -73,26 +63,11 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- 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 .)
- 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.27.0

- name: Run Linter
run: golangci-lint run --timeout=10m -v --disable-all --enable=govet --enable=staticcheck --enable=ineffassign --enable=misspell

- name: Go Test
run: |
go mod vendor && go test ./pkg/... -coverprofile=coverage.txt -covermode=atomic
Expand All @@ -106,47 +81,3 @@ jobs:

- name: Coverage
run: bash <(curl -s https://codecov.io/bash)

- name: Hello world
run: echo Hello world ${{ secrets.PROXY_DING_TOKEN }} ${{ secrets.PROXY_DING_SIGN }}

# Because the contexts of push and PR are different, there are two Notify.
# Notifications are triggered only in the arana-db/arana repository.
- name: DingTalk Message Notify only Push
uses: ./.github/actions/actions-ding
# Whether job is successful or not, always () is always true.
if: |
always() &&
github.event_name == 'push' &&
github.repository == 'dubbogo/dubbo-go-proxy'
with:
# DingDing bot token
dingToken: ${{ env.DING_TOKEN }}
secret: ${{ env.DING_SIGN }}
# Post Body to send
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "Github Actions",
"text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: ${{ github.ref }} \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n - SHA: [${{ github.sha }}](${{ github.event.compare }})"
}
}
- name: DingTalk Message Notify only PR
uses: ./.github/actions/actions-ding
if: |
always() &&
github.event_name == 'pull_request_target' &&
github.repository == 'dubbogo/dubbo-go-proxy'
with:
dingToken: ${{ env.DING_TOKEN }}
secret: ${{ env.DING_SIGN }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "Github Actions",
"text": "## Github Actions \n - name: CI \n - repository: ${{ github.repository }} \n - pr_title: ${{ github.event.pull_request.title }} \n - trigger: ${{ github.actor }} \n - event: ${{ github.event_name }} \n - ref: [${{ github.ref }}](${{ github.event.pull_request._links.html.href }}) \n - status: [${{ job.status }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) \n - environment: ${{ runner.os }} \n > SHA: [${{ github.sha }}](${{ github.event.pull_request._links.html.href }})"
}
}
45 changes: 45 additions & 0 deletions .github/workflows/licence-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# 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: License checker

on:
push:
branches:
- master
pull_request:
branches:
- master
pull_request_target:
branches:
- master

jobs:
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Check License Header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
log: info
config: .licenserc.yaml
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://golang.org/dl/go1.14.linux-amd64.tar.gz"
goversion: "https://golang.org/dl/go1.16.15.linux-amd64.tar.gz"
project_path: "./cmd/arana"
binary_name: "dubbo-go-arana"
binary_name: "arana"
12 changes: 5 additions & 7 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ name: reviewdog
on: [pull_request]
jobs:
golangci-lint:
name: review
name: runner / golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
persist-credentials: false
submodules: true
uses: actions/checkout@v3

- name: golangci-lint
uses: ./.github/actions/review-dog
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--timeout=10m"
go_version: "1.16"
7 changes: 0 additions & 7 deletions .gitmodules

This file was deleted.

0 comments on commit b68979d

Please sign in to comment.