-
Notifications
You must be signed in to change notification settings - Fork 171
164 lines (137 loc) · 5.01 KB
/
test.yaml
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Trigger test suite
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: Run tests defined for the project
runs-on: ubuntu-20.04
steps:
- name: Setup ubuntu container
run: |
sudo apt update
sudo apt install -yqq build-essential make software-properties-common
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update && sudo apt install -yqq git zip unzip zlib1g-dev zlib1g
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Cleanup hosted runner
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Set up go
id: go
uses: actions/setup-go@v5
with:
go-version: 1.20.4
cache: true
cache-dependency-path: go.sum
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/cache@v4
with:
path: /home/runner/compiled
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg
- name: Install protobuf
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
sudo apt update
sudo apt install -yqq protobuf-compiler
- name: Install dependencies
run: |
sudo apt update \
&& sudo apt install -yqq software-properties-common curl apt-transport-https lsb-release \
&& curl -fsSl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
&& sudo add-apt-repository "deb https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-14 main" \
&& sudo apt update \
&& sudo apt -yqq install clang-14 clang-tools-14 lld-14 build-essential pkg-config autoconf git python
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-14 30 \
&& sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 30 \
&& sudo update-alternatives --install /usr/bin/ld ld /usr/bin/lld-14 30
- name: Install go modules
# if: steps.go.outputs.cache-hit != 'true'
run: go mod download
- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh
- name: go fmt
run: |
git config --global --add safe.directory '*'
echo "PKG_CONFIG_PATH=/home/runner/compiled/lib/pkgconfig" >> $GITHUB_ENV
go fmt ./...
git diff --exit-code
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.52.2
skip-pkg-cache: true
args: '--disable-all --enable=gofmt --enable=vet --enable=golint --deadline=4m pm verification'
- name: Run Revive Action by building from repository
uses: docker://morphy/revive-action:v2
with:
config: config.toml
- name: misspell
uses: reviewdog/action-misspell@v1
- name: Run tests with coverage
env:
CGO_CFLAGS: "-lz"
PKG_CONFIG_PATH: "/home/runner/compiled/lib/pkgconfig"
run: |
./test.sh
./test_e2e.sh
- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CI_CODECOV_TOKEN }}
files: ./cover.out
name: ${{ github.event.repository.name }}
gcov_ignore: ./eth/stubclient.go
codeql:
name: Perform CodeQL analysis
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
editorconfig:
name: Run editorconfig checker
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/[email protected]
with:
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main
- name: Run editorconfig checker against the repo
run: editorconfig-checker