Skip to content

Update CONTRIBUTING.md #80

Update CONTRIBUTING.md

Update CONTRIBUTING.md #80

Workflow file for this run

name: CI tests
on:
pull_request:
push:
branches: [main]
jobs:
ci-test:
name: CI Go Test
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Golang
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Verify dependencies
run: go mod verify
- name: Build
run: go build -v ./...
- name: Run go vet
run: go vet ./...
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck ./...
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3
- name: Run tests
run: task run-tests
- uses: actions/upload-artifact@v2
with:
name: structviewer
retention-days: 1
path: |
structviewer.cov
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: use gh token
env:
TOKEN: "${{ secrets.ORG_GH_TOKEN }}"
run: >
git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout structviewer
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Fetch base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch origin ${{ github.base_ref }}
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Download golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
- name: golangci-lint
if: ${{ contains(fromJSON('["push","pull_request"]'), github.event_name) }}
run: |
$(go env GOPATH)/bin/golangci-lint run --out-format checkstyle --timeout=300s --max-issues-per-linter=0 --max-same-issues=0 --issues-exit-code=0 --new-from-rev=origin/${{ github.base_ref }} ./... > golanglint.xml
- uses: actions/upload-artifact@v2
with:
name: golangcilint
retention-days: 1
path: |
golanglint.xml
sonar-cloud-analysis:
name: SonarCloud Analysis
runs-on: ubuntu-latest
needs: [ci-test]
steps:
- name: Checkout Tyk structviewer
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Download coverage artifacts
uses: actions/download-artifact@v2
with:
name: structviewer
- name: Download golangcilint artifacts
uses: actions/download-artifact@v2
with:
name: golangcilint
- name: Check reports existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "structviewer.cov, golanglint.xml"
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=tyktechnologies
-Dsonar.projectKey=TykTechnologies_structviewer
-Dsonar.sources=.
-Dsonar.coverage.exclusions=**/*_test.go,**/mocks/*.go,**/tempmocks/*.go
-Dsonar.exclusions=**/mocks/*.go,**/tempmocks/*.go
-Dsonar.test.inclusions=**/*_test.go
-Dsonar.tests=.
-Dsonar.go.coverage.reportPaths=structviewer.cov
-Dsonar.go.golangci-lint.reportPaths=golanglint.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}