[TT-9464] Reverting URL encoding changes #405
Workflow file for this run
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: CI tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
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 Storage | |
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: 1.16 | |
- 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 | |
test: | |
name: Tests ${{ matrix.storagetype }} storage - DB ${{ matrix.database }} ${{ matrix.version }} | |
needs: [golangci-lint] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- storagetype: persistent | |
database: mongo | |
version: 4.4 | |
- storagetype: persistent | |
database: mongo | |
version: 4.2 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Setup Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.16 | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Build | |
run: go build -v ./... | |
- if: ${{ matrix.database == 'mongo' }} | |
name: Start MongoDB '${{ matrix.version }}' | |
uses: supercharge/mongodb-github-action@1.8.0 | |
with: | |
mongodb-version: '${{ matrix.version }}' | |
- name: Run tests | |
run: | | |
./bin/ci-tests.sh ${{ matrix.storagetype }} ${{ matrix.database }} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: coverage | |
retention-days: 1 | |
path: | | |
*.cov | |
sonar-cloud-analysis: | |
runs-on: ubuntu-latest | |
needs: [test, golangci-lint] | |
steps: | |
- name: Checkout Tyk Storage | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Setup Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.16 | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: coverage | |
- 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: '*.cov, golanglint.xml' | |
- name: Install Dependencies | |
env: | |
TOKEN: '${{ secrets.ORG_GH_TOKEN }}' | |
run: > | |
git config --global url."https://${TOKEN}@github.com".insteadOf "https://github.com" | |
go install github.com/wadey/gocovmerge@latest | |
- name: merge reports | |
run: | | |
./bin/merge-cov.sh | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
with: | |
args: > | |
-Dsonar.organization=tyktechnologies | |
-Dsonar.projectKey=TykTechnologies_storage | |
-Dsonar.sources=. | |
-Dsonar.coverage.exclusions=**/*_test.go,**/mocks/*.go | |
-Dsonar.exclusions=**/mocks/*.go | |
-Dsonar.test.inclusions=**/*_test.go | |
-Dsonar.tests=. | |
-Dsonar.go.coverage.reportPaths=*.cov | |
-Dsonar.go.golangci-lint.reportPaths=golanglint.xml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |