Skip to content

Commit c961965

Browse files
committed
Add workflow
1 parent 411add3 commit c961965

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Platform Tests
2+
on: [push, pull_request]
3+
permissions:
4+
contents: read
5+
6+
jobs:
7+
platform_tests:
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
go-version: ["", "stable"]
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v5
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-go@v6
20+
with:
21+
go-version: ${{ matrix.go-version }}
22+
go-version-file: "go.mod"
23+
24+
- name: Get dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install --no-install-recommends bc clang lld libgl1-mesa-dev libwayland-dev libx11-dev libxkbcommon-dev xorg-dev xvfb language-pack-en
28+
echo "CC=clang" >> "$GITHUB_ENV"
29+
echo "CGO_LDFLAGS=-fuse-ld=lld" >> "$GITHUB_ENV"
30+
if: ${{ runner.os == 'Linux' }}
31+
32+
- name: Test
33+
run: go test -tags ci -covermode=atomic -coverprofile="coverage.out" ./...
34+
35+
- name: Update coverage
36+
run: |
37+
set -e
38+
coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'`
39+
if (( $(echo "$coverage < 13" | bc) )); then echo "Test coverage lowered"; exit 1; fi
40+
if: ${{ runner.os == 'Linux' && matrix.go-version == 'stable' }}
41+
42+
- name: Update PR Coverage
43+
uses: shogo82148/actions-goveralls@v1
44+
with:
45+
path-to-profile: coverage.out
46+
if: ${{ runner.os == 'Linux' && matrix.go-version == 'stable' }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Static Analysis
2+
on: [push, pull_request]
3+
permissions:
4+
contents: read
5+
env:
6+
CC: "clang"
7+
CGO_LDFLAGS: "-fuse-ld=lld"
8+
9+
jobs:
10+
checks:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v5
15+
with:
16+
persist-credentials: false
17+
- uses: actions/setup-go@v6
18+
with:
19+
go-version: "stable"
20+
21+
- name: Get dependencies
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install --no-install-recommends clang lld libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev xvfb language-pack-en
25+
26+
- name: Set environment variable LANG
27+
run: export LANG=en_EN.UTF-8
28+
29+
- name: Install analysis tools
30+
run: |
31+
go install mvdan.cc/gofumpt@latest
32+
go install golang.org/x/tools/cmd/goimports@latest
33+
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
34+
go install honnef.co/go/tools/cmd/staticcheck@latest
35+
go install lucor.dev/lian@latest
36+
37+
- name: Vet
38+
run: go vet ./...
39+
40+
- name: Formatting
41+
run: |
42+
gofumpt -d -e .
43+
test -z "$(goimports -e -d . | tee /dev/stderr)"
44+
45+
- name: Gocyclo
46+
run: gocyclo -over 30 .
47+
48+
- name: Staticcheck
49+
run: staticcheck ./...
50+
51+
- name: Check license of dependencies
52+
run: lian -d --allowed="Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, ISC"

0 commit comments

Comments
 (0)