Skip to content

Commit 667e470

Browse files
committed
ci: add test jobs
Signed-off-by: CrazyMax <[email protected]>
1 parent e7e9118 commit 667e470

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

.github/workflows/build.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,71 @@ on:
1111

1212
env:
1313
DESTDIR: ./bin
14+
GO_VERSION: 1.16.7
1415

1516
jobs:
17+
test:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os:
23+
- ubuntu-20.04
24+
- macOS-11
25+
- windows-2022
26+
steps:
27+
-
28+
name: Checkout
29+
uses: actions/checkout@v3
30+
-
31+
name: Set up Go
32+
uses: actions/setup-go@v3
33+
with:
34+
go-version: ${{ env.GO_VERSION }}
35+
cache: true
36+
-
37+
name: Install deps
38+
if: ${{ matrix.os == 'ubuntu-20.04' }}
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass
42+
-
43+
name: Test
44+
run: |
45+
go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./...
46+
go tool cover -func=./coverage.txt
47+
shell: bash
48+
-
49+
name: Upload coverage
50+
uses: codecov/codecov-action@v3
51+
with:
52+
file: ./coverage.txt
53+
54+
test-sandboxed:
55+
runs-on: ubuntu-20.04
56+
steps:
57+
-
58+
name: Checkout
59+
uses: actions/checkout@v3
60+
-
61+
name: Set up Docker Buildx
62+
uses: docker/setup-buildx-action@v2
63+
-
64+
name: Test
65+
uses: docker/bake-action@v2
66+
with:
67+
targets: test
68+
set: |
69+
*.cache-from=type=gha,scope=test
70+
*.cache-to=type=gha,scope=test,mode=max
71+
-
72+
name: Upload coverage
73+
uses: codecov/codecov-action@v3
74+
with:
75+
file: ${{ env.DESTDIR }}//coverage.txt
76+
1677
build:
17-
runs-on: ubuntu-latest
78+
runs-on: ubuntu-20.04
1879
steps:
1980
-
2081
name: Checkout
@@ -30,6 +91,9 @@ jobs:
3091
uses: docker/bake-action@v2
3192
with:
3293
targets: binaries
94+
set: |
95+
*.cache-from=type=gha,scope=build
96+
*.cache-to=type=gha,scope=build,mode=max
3397
-
3498
name: Move artifacts
3599
run: |

0 commit comments

Comments
 (0)