mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-10 00:02:54 +01:00
Create Codecov workflow for Go project
Added a new workflow in '.github/workflows/codecov.yml' that runs on all three OS: Ubuntu, MacOS, and Windows with '1.22' version of Go. This workflow performs a test coverage check and then uploads the coverage data to Codecov. The workflow is activated on every 'push' or 'pull request' to the 'main' branch.
This commit is contained in:
parent
82b015d819
commit
c866d0775f
8 changed files with 49 additions and 178 deletions
|
@ -1,45 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
name: SonarQube
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main # or the name of your main branch
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main # or the name of your main branch
|
|
||||||
env:
|
|
||||||
API_KEY: ${{ secrets.API_KEY }}
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: docker
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.22'
|
|
||||||
|
|
||||||
- name: Run unit Tests
|
|
||||||
run: |
|
|
||||||
go test -v -shuffle=on -race --coverprofile=./cov.out ./...
|
|
||||||
|
|
||||||
- name: Install jq
|
|
||||||
run: |
|
|
||||||
apt-get update; apt-get -y install jq; which jq
|
|
||||||
|
|
||||||
- uses: sonarsource/sonarqube-scan-action@master
|
|
||||||
env:
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
||||||
|
|
||||||
- uses: sonarsource/sonarqube-quality-gate-action@master
|
|
||||||
timeout-minutes: 5
|
|
||||||
env:
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
44
.github/workflows/codecov.yml
vendored
Normal file
44
.github/workflows/codecov.yml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
name: Codecov workflow
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '**.go'
|
||||||
|
- 'go.*'
|
||||||
|
- '.github/**'
|
||||||
|
- 'codecov.yml'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '**.go'
|
||||||
|
- 'go.*'
|
||||||
|
- '.github/**'
|
||||||
|
- 'codecov.yml'
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
go: ['1.22']
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Setup go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
go test -v -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
|
if: success() && matrix.go == '1.22' && matrix.os == 'ubuntu-latest'
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
|
@ -1,4 +1,4 @@
|
||||||
# SPDX-FileCopyrightText: 2022 Winni Neessen <wn@neessen.dev>
|
# SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
golangci:
|
golangci:
|
||||||
name: lint
|
name: lint
|
||||||
runs-on: docker
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '1.22'
|
go-version: '1.22'
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
32
.github/workflows/release-bsd.yml
vendored
32
.github/workflows/release-bsd.yml
vendored
|
@ -1,32 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
name: Go
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [ created ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
releases-matrix:
|
|
||||||
name: Release Go Binary (BSDs)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [freebsd, netbsd, openbsd]
|
|
||||||
goarch: ["386", amd64, arm, arm64]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: wangyoucao577/go-release-action@v1.26
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
|
||||||
binary_name: "apg"
|
|
||||||
extra_files: LICENSE README.md
|
|
||||||
sha256sum: true
|
|
||||||
md5sum: false
|
|
||||||
ldflags: '-s -w'
|
|
||||||
project_path: ./cmd/apg/
|
|
32
.github/workflows/release-darwin.yml
vendored
32
.github/workflows/release-darwin.yml
vendored
|
@ -1,32 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
name: Go
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [ created ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
releases-matrix:
|
|
||||||
name: Release Go Binary (Darwin)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [darwin]
|
|
||||||
goarch: [amd64, arm64]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: wangyoucao577/go-release-action@v1.26
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
|
||||||
binary_name: "apg"
|
|
||||||
extra_files: LICENSE README.md
|
|
||||||
sha256sum: true
|
|
||||||
md5sum: false
|
|
||||||
ldflags: '-s -w'
|
|
||||||
project_path: ./cmd/apg/
|
|
32
.github/workflows/release-linux.yml
vendored
32
.github/workflows/release-linux.yml
vendored
|
@ -1,32 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
name: Go
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [ created ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
releases-matrix:
|
|
||||||
name: Release Go Binary (Linux)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [linux]
|
|
||||||
goarch: ["386", amd64, arm, arm64, ppc64le, s390x]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: wangyoucao577/go-release-action@v1.26
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
|
||||||
binary_name: "apg"
|
|
||||||
extra_files: LICENSE README.md
|
|
||||||
sha256sum: true
|
|
||||||
md5sum: false
|
|
||||||
ldflags: '-s -w'
|
|
||||||
project_path: ./cmd/apg/
|
|
32
.github/workflows/release-windows.yml
vendored
32
.github/workflows/release-windows.yml
vendored
|
@ -1,32 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
name: Go
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [ created ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
releases-matrix:
|
|
||||||
name: Release Go Binary (Windows)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [windows]
|
|
||||||
goarch: ["386", amd64, arm]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: wangyoucao577/go-release-action@v1.26
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
|
||||||
binary_name: "apg"
|
|
||||||
extra_files: LICENSE README.md
|
|
||||||
sha256sum: true
|
|
||||||
md5sum: false
|
|
||||||
ldflags: '-s -w'
|
|
||||||
project_path: ./cmd/apg/
|
|
|
@ -1,4 +1,4 @@
|
||||||
# SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
|
# SPDX-FileCopyrightText: 2022 Winni Neessen <winni@neessen.dev>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: docker
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: REUSE Compliance Check
|
- name: REUSE Compliance Check
|
Loading…
Reference in a new issue