Adds a "local" storage driver that handles all operations in memory #702
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 | |
env: | |
GO_VERSION: "1.18" | |
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: ${{ 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 | |
test: | |
name: Tests ${{ matrix.storagetype }} storage - DB ${{ matrix.database }} ${{ matrix.version }} ${{ matrix.instancetype }} | |
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 | |
- storagetype: persistent | |
database: mongo | |
version: 7.0 | |
- storagetype: persistent | |
database: mongo | |
version: 6.0 | |
- storagetype: temporal | |
database: redis | |
version: 6.0.0 | |
instancetype: single | |
- storagetype: temporal | |
database: redis | |
version: 7.0.0 | |
instancetype: single | |
- storagetype: temporal | |
database: redis | |
version: 6.0.0 | |
instancetype: cluster | |
- storagetype: temporal | |
database: redis | |
version: 7.0.0 | |
instancetype: cluster | |
- storagetype: temporal | |
database: redis | |
version: 7.2.0 | |
instancetype: single | |
- storagetype: temporal | |
database: redis | |
version: 7.0.0 | |
instancetype: TLS | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Setup Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Build | |
run: go build -v ./... | |
- name: Install Task | |
uses: arduino/setup-task@v1 | |
with: | |
version: 3 | |
- if: ${{ matrix.database == 'mongo' }} | |
name: Start MongoDB '${{ matrix.version }}' | |
run: task -t bin/Taskfile-db.yml start-mongo MONGO_VERSION=${{ matrix.version }} | |
- if: ${{ matrix.database == 'redis' }} | |
name: Start Redis '${{ matrix.version }}' | |
run: task -t bin/Taskfile-db.yml start-redis-${{matrix.instancetype}} REDIS_VERSION=${{ matrix.version }} | |
- name: Run tests | |
env: | |
DB: ${{ matrix.database }} | |
DB_SETUP: ${{ matrix.instancetype }} | |
DB_VERSION: ${{ matrix.version }} | |
run: task test-${{ matrix.storagetype }} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: coverage | |
retention-days: 1 | |
path: coverage/**/*.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: ${{ env.GO_VERSION }} | |
- 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: "coverage/*.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: Install Task | |
uses: arduino/setup-task@v1 | |
with: | |
version: 3 | |
- name: merge reports | |
run: task merge-coverage | |
- 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,**/tempmocks/*.go | |
-Dsonar.exclusions=**/mocks/*.go,**/tempmocks/*.go | |
-Dsonar.test.inclusions=**/*_test.go | |
-Dsonar.tests=. | |
-Dsonar.go.coverage.reportPaths=merged-coverage.cov | |
-Dsonar.go.golangci-lint.reportPaths=golanglint.xml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |