-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
241a29f
commit ef9365e
Showing
1 changed file
with
9 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,57 +2,54 @@ name: Go CI | |
|
||
on: | ||
push: | ||
branches: [ main ] | ||
branches: | ||
- main | ||
tags: | ||
- 'v*' # This will trigger the workflow for any tag starting with 'v' | ||
pull_request: | ||
branches: [ main ] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: Test and Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: go mod download | ||
|
||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: latest | ||
args: --config=.golangci.yml | ||
|
||
- name: Run tests with coverage | ||
run: go test -v -coverprofile=coverage.out ./... | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
release: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') # This job runs only for tags starting with 'v' | ||
if: startsWith(github.ref, 'refs/tags/v') # Ensure this runs only for tags starting with 'v' | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Create GitHub Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub, no need to set this secret yourself | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
|