forked from filecoin-project/venus
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (68 loc) · 2.27 KB
/
Copy pathcommon_go.yml
File metadata and controls
82 lines (68 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: build and golangci-lint and test
on:
workflow_call:
inputs:
test_timeout:
description: 'specifies the amount of minutes for test timeout'
required: false
default: 10
type: number
has_ffi:
type: boolean
log_level:
description: 'specifies the log level'
required: false
default: info
type: string
jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: vars
id: vars
run: |
export repo_name=${GITHUB_REPOSITORY##*/}
echo "::set-output name=repo_name::$repo_name"
- name: show vars
run: |
echo vars.repo_name = ${{steps.vars.outputs.repo_name}}
- name: install default deps
run: sudo apt-get -o Acquire::Retries=3 update && sudo apt-get -o Acquire::Retries=3 install make ftp git bzr curl wget -y
- name: install deps
if: ${{ inputs.has_ffi }}
run: sudo apt-get -o Acquire::Retries=3 update && sudo apt-get -o Acquire::Retries=3 install hwloc libhwloc-dev mesa-opencl-icd ocl-icd-opencl-dev -y
- name: Build
env:
GOPROXY: "https://proxy.golang.org,direct"
GO111MODULE: "on"
run: |
make
- name: Lint
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
golangci-lint run --timeout 10m
- name: Detect changes
run: |
go mod tidy
git status --porcelain
test -z "$(git status --porcelain)"
- name: Run coverage
run: |
export GOLOG_LOG_LEVEL=${{ inputs.log_level }}
go test -coverpkg=./... -race -coverprofile=coverage.txt -covermode=atomic ./... -v --timeout ${{ inputs.test_timeout }}m
# https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652
- name: Upload
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.txt
flags: unittests
name: ${{steps.vars.outputs.repo_name}}
fail_ci_if_error: false
verbose: true