Skip to content

Commit

Permalink
fix: test workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Eray Ates <[email protected]>
  • Loading branch information
rytsh committed Jun 19, 2024
1 parent be0467d commit 12ae224
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 65 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/golangci-lint.yml

This file was deleted.

57 changes: 42 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
name: Test

on: [push, pull_request]
on: [push]

name: Test
jobs:
test:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ secrets.GO_VERSION }}

- name: Run coverage
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
- name: get repository name
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.21' # The Go version to download (if necessary) and use.
- name: golangci config
run: |
[[ ! -f ".golangci.yml" ]] && curl -kfsSL -O https://raw.githubusercontent.com/worldline-go/guide/main/lint/.golangci.yml
echo GOPATH="$(dirname ${PWD})" >> $GITHUB_ENV
- name: golangci-lint general
uses: golangci/golangci-lint-action@v3
with:
args: --issues-exit-code 0 --out-format checkstyle:golangci-lint-report.out,colored-line-number
- name: golangci-lint critical check
run: |
golangci-lint run --new-from-rev remotes/origin/${{ github.event.repository.default_branch }} ./...
- name: Run tests
run: |
go test -coverprofile=coverage.out -json ./... > test-report.out
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=${{ github.repository_owner }}
-Dsonar.projectKey=${{ github.repository_owner }}_${{ env.REPOSITORY_NAME }}
-Dsonar.go.coverage.reportPaths=coverage.out
-Dsonar.go.tests.reportPaths=test-report.out
-Dsonar.go.golangci-lint.reportPaths=golangci-lint-report.out
-Dsonar.sources=.
-Dsonar.exclusions=**/vendor/**,**/*_test.go
-Dsonar.tests=.
-Dsonar.test.inclusions=**/*_test.go
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# igconfig

[![Codecov](https://img.shields.io/codecov/c/github/worldline-go/igconfig?logo=codecov&style=flat-square)](https://app.codecov.io/gh/worldline-go/igconfig)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/worldline-go/igconfig/test.yml?branch=master&logo=github&style=flat-square&label=ci)](https://github.com/worldline-go/igconfig/actions)
[![Go Reference](https://pkg.go.dev/badge/github.com/worldline-go/igconfig.svg)](https://pkg.go.dev/github.com/worldline-go/igconfig)
[![License](https://img.shields.io/github/license/worldline-go/igconfig?color=red&style=flat-square)](https://raw.githubusercontent.com/worldline-go/igconfig/main/LICENSE)
[![Coverage](https://img.shields.io/sonar/coverage/worldline-go_igconfig?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io&style=flat-square)](https://sonarcloud.io/summary/overall?id=worldline-go_igconfig)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/worldline-go/igconfig/test.yml?branch=main&logo=github&style=flat-square&label=ci)](https://github.com/worldline-go/igconfig/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/worldline-go/igconfig?style=flat-square)](https://goreportcard.com/report/github.com/worldline-go/igconfig)
[![Go PKG](https://raw.githubusercontent.com/worldline-go/guide/main/badge/custom/reference.svg)](https://pkg.go.dev/github.com/worldline-go/igconfig)


This package can be used to load configuration values from a configuration file,
environment variables, Consul, Vault and/or command-line parameters.
Expand Down

0 comments on commit 12ae224

Please sign in to comment.