use goreleaser v2 #1144
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
name: Build | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths-ignore: | |
- 'docs/**' | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go_version: ['1.23'] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
env: | |
OS: ${{ matrix.os }} | |
GO: ${{ matrix.go_version }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go ${{ matrix.go_version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go_version }} | |
check-latest: true | |
cache: true | |
- name: Set up Node.js LTS for running JSON schema tests (using ajv) | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.60 | |
- name: Test | |
run: make test-ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: make build | |
- name: Code coverage with codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
env_vars: OS,GO | |
file: ./coverage.out | |
flags: unittests | |
fail_ci_if_error: false | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report-${{ matrix.os }} | |
path: coverage.out | |
sonarCloudTrigger: | |
needs: build | |
name: SonarCloud Trigger | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Download code coverage results | |
uses: actions/download-artifact@v4 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Analyze with SonarCloud | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |