Skip to content

Commit

Permalink
Feature(actions): add testing (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu authored Aug 20, 2024
1 parent 66fafd2 commit 776e647
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 3 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 ./...

0 comments on commit 776e647

Please sign in to comment.