This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
Run tests #1978
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: Run tests | |
on: | |
pull_request: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "0 0 * * *" | |
defaults: | |
run: | |
shell: bash | |
# Concurrency ensures that only a single workflow using the same concurrency group will run at a time. | |
# When a workflow is queued in the same repository and concurrency group, any workflow in progress will be cancelled. | |
# This concurrency group is keyed to the 'ref' property in the 'github' context, to map back to the branch/tag that | |
# triggered this workflow run. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
matrix-generator: | |
uses: ./.github/workflows/setup_k8s_matrix.yaml | |
test: | |
runs-on: ubuntu-20.04 | |
needs: matrix-generator | |
strategy: | |
fail-fast: false | |
matrix: | |
k8s-version: ${{ fromJSON(needs.matrix-generator.outputs.k8s-matrix) }} | |
tyk-version: ['v3.2','v4.0','v5.0','v5.2'] | |
mode: ['ce','pro'] | |
env: | |
CLUSTER_NAME: 'chart-testing' | |
TYK_MODE: ${{ matrix.mode }} | |
steps: | |
- name: Checkout tyk-operator | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create Kind cluster | |
uses: helm/[email protected] | |
with: | |
wait: 2m | |
node_image: "kindest/node:${{ matrix.k8s-version }}" | |
config: hack/kind.yaml | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21.x | |
- name: Cache Go Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Bootstrap Tyk CE environment | |
if: ${{ env.TYK_MODE == 'ce' }} | |
run: | | |
TYK_VERSION=${{ matrix.tyk-version}} make boot-ce IMG=tykio/tyk-operator:test | |
- name: Bootstrap Tyk PRO environment | |
if: ${{ env.TYK_MODE == 'pro' }} | |
env: | |
TYK_DB_LICENSEKEY: ${{ secrets.DASH_LICENSE }} | |
run: | | |
TYK_VERSION=${{ matrix.tyk-version}} make boot-pro IMG=tykio/tyk-operator:test | |
- name: Run tests | |
run: | | |
make test-all | |
- name: Upload Coverage files | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test coverage files | |
path: '*_coverage.out' | |
sbom: | |
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@main | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | |
secrets: | |
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }} | |
DEPDASH_URL: ${{ secrets.DEPDASH_URL }} | |
DEPDASH_KEY: ${{ secrets.DEPDASH_KEY }} | |
ORG_GH_TOKEN: ${{ secrets.ORG_GH_TOKEN }} | |
DOCKER_IMAGE: "tykio/tyk-operator:latest" | |
sonarcloud: | |
runs-on: ubuntu-20.04 | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | |
needs: test | |
steps: | |
- name: Checkout tyk-operator | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download Coverage files | |
uses: actions/download-artifact@v2 | |
with: | |
name: test coverage files | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.ORG_GH_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |