Browse Source

Feature(actions): add testing (#378)

pull/383/merge
Jason Lyu 3 months ago
committed by GitHub
parent
commit
776e6470d3
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/codeql-analysis.yml
  2. 8
      .github/workflows/docker.yml
  3. 6
      .github/workflows/linter.yml
  4. 14
      .github/workflows/release.yml
  5. 31
      .github/workflows/test.yml

2
.github/workflows/codeql-analysis.yml

@ -38,4 +38,4 @@ jobs:
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v3

8
.github/workflows/docker.yml

@ -12,13 +12,11 @@ on:
- '*'
jobs:
build:
name: Build
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

6
.github/workflows/linter.yml

@ -11,10 +11,12 @@ on:
pull_request:
jobs:
lint:
linter:
name: Linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5

14
.github/workflows/release.yml

@ -10,11 +10,11 @@ on:
- '*'
jobs:
build:
name: Build
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
@ -28,15 +28,13 @@ jobs:
- name: Cache go module
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run test
run: |
go test ./...
- name: Build
if: startsWith(github.ref, 'refs/tags/')
run: make -j releases

31
.github/workflows/test.yml

@ -0,0 +1,31 @@
name: Test
concurrency:
group: test-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'main'
pull_request:
jobs:
build-test:
name: Build Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: 'go.mod'
- name: Run test
run: |
go test ./...
Loading…
Cancel
Save