TT-12174 Added support for proxy settings loaded from environment variables #230
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: Go Test Workflow | |
on: | |
push: | |
branches: | |
- master | |
- release-** | |
pull_request: | |
branches: | |
- master | |
- release-** | |
env: | |
TYK_IB_STORAGE_STORAGETYPE: file | |
permissions: | |
contents: read | |
jobs: | |
golangci-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Tyk Identity Broker | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Fetch base branch | |
if: ${{ github.event_name == 'pull_request' }} | |
run: git fetch origin ${{ github.base_ref }} | |
- name: golangci-lint | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
args: --out-format=checkstyle:golanglint.xml --timeout=600s --max-issues-per-linter=0 --max-same-issues=0 --new-from-rev=origin/${{ github.base_ref }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: golangcilint | |
retention-days: 1 | |
path: | | |
golanglint.xml | |
ci-test: | |
name: "${{ matrix.databases }}" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
databases: | |
- mongo-mgo | |
- mongo-official | |
- file | |
redis-version: [5] | |
mongodb-version: [4.2] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "^1.21" | |
- name: Install Dependencies and basic hygiene test | |
id: hygiene | |
run: | | |
go install golang.org/x/tools/cmd/goimports@latest | |
- name: Start Redis | |
uses: supercharge/redis-github-action@1.2.0 | |
with: | |
redis-version: ${{ matrix.redis-version }} | |
- name: Start MongoDB | |
uses: supercharge/mongodb-github-action@1.2.0 | |
with: | |
mongodb-version: "${{ matrix.mongodb-version }}" | |
- name: Run tests | |
run: | | |
./bin/ci-tests.sh ${{ matrix.databases }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
retention-days: 1 | |
path: | | |
*cov | |
sonar-cloud-analysis: | |
runs-on: ubuntu-latest | |
needs: [ci-test, golangci-lint] | |
steps: | |
- name: Checkout TIB | |
uses: actions/checkout@v4 | |
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.22.6 | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: Download golangcilint artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: golangcilint | |
- name: Check reports existence | |
id: check_files | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: "*.cov, golanglint.xml" | |
- name: Install Dependencies | |
run: > | |
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_tyk-identity-broker | |
-Dsonar.sources=. | |
-Dsonar.exclusions=ci/** | |
-Dsonar.coverage.exclusions=**/*_test.go,**/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 }} |