Skip to content

Commit d585263

Browse files
committed
add test workflow
Signed-off-by: t-kikuc <tkikuchi07f@gmail.com>
1 parent 1a3287e commit d585263

File tree

3 files changed

+64
-3
lines changed

3 files changed

+64
-3
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ jobs:
2323
with:
2424
go-version: ${{ env.GO_VERSION }}
2525
cache: true
26-
- name: Build go plugins
26+
- name: Build go plugins # TODO: Make it parallel
2727
run: make build/go

.github/workflows/lint.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ jobs:
4343
golangci_lint_flags: --config ${{ github.workspace }}/.golangci.yml
4444
fail_on_error: true # Although this option was deprecated on v2.7.0, it's still available because we use v2.1.3,
4545

46-
# This job is used to check if the go linting is completed successfully
47-
# It is used to set as required check for the branch protection rules
46+
# This job is used to check for the branch protection rules.
4847
go-lint-completed:
4948
runs-on: ubuntu-24.04
5049
needs: go

.github/workflows/test.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# tags:
8+
# - 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
# - 'release-v*'
13+
14+
env:
15+
GO_VERSION: 1.24.3
16+
17+
jobs:
18+
list-go-modules:
19+
runs-on: ubuntu-24.04
20+
outputs:
21+
modules: ${{ steps.list-go-modules.outputs.modules }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: List go modules
25+
id: list-go-modules
26+
run: |
27+
echo "modules=$(find . -name go.mod -exec dirname {} \; | sort | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT
28+
29+
go:
30+
runs-on: ubuntu-latest-8-cores
31+
needs: list-go-modules
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
module: ${{ fromJSON(needs.list-go-modules.outputs.modules) }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: actions/setup-go@v4
39+
with:
40+
go-version: ${{ env.GO_VERSION }}
41+
cache: true
42+
- name: Run unit tests
43+
run: make test/go PLUGINS=${{ matrix.module }} # COVERAGE=true
44+
# TODO: Add coverage reporting
45+
# - name: make flag
46+
# id: make-flag
47+
# run: |
48+
# echo "flags=$(echo ${{ matrix.module }} | tr '/' '-')" >> $GITHUB_OUTPUT
49+
# - name: Upload coverage reports to Codecov
50+
# uses: codecov/codecov-action@v3
51+
# with:
52+
# flags: ${{ steps.make-flag.outputs.flags }}
53+
# env:
54+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55+
56+
# This job is used to check for the branch protection rules.
57+
go-test-completed:
58+
runs-on: ubuntu-24.04
59+
needs: go
60+
steps:
61+
- run: |
62+
echo completed

0 commit comments

Comments
 (0)