Merge pull request #36 from SAP/validateJson #24
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: Overall Test Workflow | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
paths-ignore: | |
- '*.md' | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '*.md' | |
workflow_dispatch: | |
workflow_call: | |
# Testing only needs permissions to read the repository contents. | |
permissions: | |
contents: read | |
jobs: | |
# Ensure project builds before running tests | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- run: go mod download | |
- name: Build CLI | |
run: go build -v ./... | |
- name: Run linters | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
generate: | |
if: github.event.pull_request.draft == false | |
name: Docu Generation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- run: go run main.go gendoc | |
- name: git diff | |
run: | | |
git add . | |
git diff --staged --compact-summary --no-color --exit-code || \ | |
(echo; echo "Unexpected difference docu generation. Run 'make docs' command and commit."; exit 1) | |
test: | |
if: github.event.pull_request.draft == false | |
name: Unit Tests | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- run: go mod download | |
- run: go test -v -cover -tags=all -timeout=900s -parallel=4 ./... | |
timeout-minutes: 10 | |
# # Upload coverage report | |
# - uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-report | |
# path: cover.out | |
# sonarcloud: | |
# if: github.event.pull_request.draft == false | |
# name: SonarCloud | |
# needs: test | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: coverage-report | |
# - name: SonarCloud Scan | |
# uses: SonarSource/sonarcloud-github-action@master | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |