Skip to content

Commit cac203a

Browse files
committed
add a new job unit test
1 parent f960caa commit cac203a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/unit-test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Unit Test
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- "go.mod"
10+
- "**.go"
11+
# Limit one unit test job running per PR/Branch
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
# For example, if you push multiple commits to a pull request in quick succession, only the latest workflow run will continue
15+
cancel-in-progress: true
16+
env:
17+
GOPROXY: https://proxy.golang.org
18+
GO_VERSION: '1.24.0'
19+
permissions:
20+
contents: read
21+
jobs:
22+
unit_test:
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ubuntu-22.04, macos-13, windows-2022]
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
30+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
31+
with:
32+
go-version: ${{env.GO_VERSION}}
33+
cache: true
34+
- name: Download Dependencies
35+
run: go mod download
36+
- name: Install libvirt (Linux)
37+
if: runner.os == 'Linux'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y libvirt-dev
41+
- name: Install make (Windows)
42+
if: runner.os == 'Windows'
43+
run: choco install make -y
44+
- name: unit test
45+
env:
46+
TESTSUITE: unittest
47+
run: make test
48+
continue-on-error: false
49+

0 commit comments

Comments
 (0)