ci: add job to lint buld and package geth

This commit is contained in:
barryz 2021-09-07 15:20:44 +08:00
parent 66202edefe
commit 2dde18f71d
3 changed files with 172 additions and 0 deletions

23
.github/labeler.yml vendored Normal file
View file

@ -0,0 +1,23 @@
Need-Review:
- '*/**/*'
CI:
- any: ['.github/**/*']
Eth:
- any: ['eth/**/*']
P2p:
- any: ['p2p/**/*']
Ops:
- any: ['metrics/**/*']
Node:
- any: ['node/**/*']
Core:
- any: ['core/**/*']
Version-Bump:
- any: ['params/version.go']

127
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,127 @@
name: geth unit tests
on:
push:
branches:
- 'debank'
pull_request:
branches:
- 'debank'
workflow_dispatch:
env:
TEMP_ARTIFACT_NAME: geth
BUILT_BINARY_PATH: build/bin
BUILT_BINARY_NAME: geth
OSS_ARCHIVE_FILE_NAME: eth-latest-linux-amd64
OSS_ARCHIVE_BUCKET: debank-artifacts
OSS_ARCHIVE_FILE_PREFIX: downloads
OSS_DOMESTIC_ENDPOINT: oss-cn-hangzhou.aliyuncs.com
defaults:
run:
working-directory: ./
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Configure git for private modules
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/DeBankDeFi".insteadOf "https://github.com/DeBankDeFi"
- name: Golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42.1
only-new-issues: true
build:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Make binaries
run: |
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/DeBankDeFi".insteadOf "https://github.com/DeBankDeFi"
make geth
- name: Archive built binaries
uses: actions/upload-artifact@v2
with:
name: ${{ env.TEMP_ARTIFACT_NAME }}
path: ${{ env.BUILT_BINARY_PATH }}/${{ env.BUILT_BINARY_NAME }}
retention-days: 1
package:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download built binaries
uses: actions/download-artifact@v2
with:
name: ${{ env.TEMP_ARTIFACT_NAME }}
path: ${{ env.BUILT_BINARY_PATH }}
- name: Archive artifacts
run: |
mkdir $OSS_ARCHIVE_FILE_NAME
cp $BUILT_BINARY_PATH/$BUILT_BINARY_NAME $OSS_ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME
sha256sum $OSS_ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME --tag >> $OSS_ARCHIVE_FILE_NAME/sha256.checksum
chmod u+x $OSS_ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME
$OSS_ARCHIVE_FILE_NAME/$BUILT_BINARY_NAME version
tar cvfz $OSS_ARCHIVE_FILE_NAME.tar.gz $OSS_ARCHIVE_FILE_NAME
- name: Setup aliyun oss
uses: barryz/setup-ossutil@master
with:
endpoint: ${{ env.OSS_DOMESTIC_ENDPOINT }}
access-key-id: ${{ secrets.OSS_KEY_ID }}
access-key-secret: ${{ secrets.OSS_KEY_SECRET }}
- name: Copy artifacts to oss
run: |
ossutil cp -rf $OSS_ARCHIVE_FILE_NAME.tar.gz oss://$OSS_ARCHIVE_BUCKET/$OSS_ARCHIVE_FILE_PREFIX/$OSS_ARCHIVE_FILE_NAME.tar.gz
ossutil set-acl oss://$OSS_ARCHIVE_BUCKET/$OSS_ARCHIVE_FILE_PREFIX/$OSS_ARCHIVE_FILE_NAME.tar.gz public-read
- name: comment PR
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: "Artifacts uploaded, click or copy [this link](https://${{ env.OSS_ARCHIVE_BUCKET }}.${{ env.OSS_DOMESTIC_ENDPOINT }}/${{ env.OSS_ARCHIVE_FILE_PREFIX }}/${{ env.OSS_ARCHIVE_FILE_NAME }}.tar.gz) to download. :tada:"
check_for_duplicate_msg: true
continue-on-error: true

22
.github/workflows/labeler.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: "Pull Request Labeler"
on:
push:
branches:
- 'debank'
pull_request:
branches:
- 'debank'
workflow_dispatch:
defaults:
run:
working-directory: ./
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml