From 5574af85930f7d850a329468517458fc167f80f5 Mon Sep 17 00:00:00 2001 From: Gromit Date: Fri, 27 Sep 2024 08:52:10 +0000 Subject: [PATCH] Auto generated from templates by gromit --- .github/workflows/release.yml | 40 +++++++++++++++++++++++------------ ci/goreleaser/goreleaser.yml | 3 +++ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec5178dfbd7..f6a6238fe6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,5 @@ +# yamllint disable rule:line-length rule:truthy +name: Release # Generated by: gromit policy # Distribution channels covered by this workflow @@ -6,8 +8,9 @@ # - docker hub # - devenv ECR # - Cloudsmith - -name: Release +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} on: # Trigger release every monday at midnight for master CI images schedule: @@ -21,13 +24,14 @@ on: - 'v*' env: GOPRIVATE: github.com/TykTechnologies - VARIATION: prod + VARIATION: inverted DOCKER_BUILD_SUMMARY: false DOCKER_BUILD_RECORD_UPLOAD: false # startsWith covers pull_request_target too BASE_REF: ${{startsWith(github.event_name, 'pull_request') && github.base_ref || github.ref_name}} jobs: goreleaser: + if: github.event.pull_request.draft == false name: '${{ matrix.golang_cross }}' runs-on: ubuntu-latest-m permissions: @@ -181,7 +185,6 @@ jobs: latest=false prefix=v tags: | - type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{version}} labels: "org.opencontainers.image.title=tyk-gateway \norg.opencontainers.image.description=Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols\norg.opencontainers.image.vendor=tyk.io\norg.opencontainers.image.version=${{ github.ref_name }}\n" @@ -220,6 +223,7 @@ jobs: !dist/*PAYG*.rpm !dist/*fips*.rpm test-controller-api: + if: github.event.pull_request.draft == false needs: - goreleaser runs-on: ubuntu-latest @@ -315,21 +319,16 @@ jobs: ./dash-bootstrap.sh http://localhost:3000 docker compose -p auto -f pro-ha.yml -f deps_pro-ha.yml -f ${{ matrix.envfiles.db }}.yml -f ${{ matrix.envfiles.cache }}.yml --env-file versions.env --profile slave-datacenter up --quiet-pull -d echo "$(cat pytest.env | grep USER_API_SECRET)" >> $GITHUB_OUTPUT + echo "ts=$(date +%s%N)" >> $GITHUB_OUTPUT - uses: actions/checkout@v4 with: repository: TykTechnologies/tyk-analytics path: tyk-analytics token: ${{ secrets.ORG_GH_TOKEN }} fetch-depth: 1 + ref: ${{ env.BASE_REF }} + ref: $BASE_REF sparse-checkout: tests/api - - name: Branch for test code - id: timestamp - working-directory: tyk-analytics/tests/api - run: | - # Generate report id - git fetch --no-tags --depth 1 origin "refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}" - git switch $BASE_REF - echo "ts=$(date +%s%N)" >> $GITHUB_OUTPUT - uses: actions/setup-python@v5 with: cache: 'pip' @@ -358,11 +357,25 @@ jobs: USER_API_SECRET=${{ steps.env_up.outputs.USER_API_SECRET }} EOF env $(cat pytest.env | xargs) $pytest -m "${{ matrix.envfiles.apimarkers }}" + - name: Upload Playwright Test Report to S3 + if: failure() && steps.test_execution.outcome != 'success' && steps.env_up.outcome == 'success' + run: npm run upload_report_to_s3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UI_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UI_AWS_SECRET_ACCESS_KEY }} + RUN_ID: 'tyk-analytics/${{ github.run_id }}' + working-directory: tyk-analytics/tests/ui + - name: Share S3 report link into summary + if: failure() && steps.test_execution.outcome != 'success' && steps.env_up.outcome == 'success' + run: | + echo "# :clipboard: S3 UI Test REPORT: ${{ matrix.envfiles.db }}-${{ matrix.envfiles.conf }}" >> $GITHUB_STEP_SUMMARY + echo "- Status: ${{ steps.test_execution.outcome == 'success' && ':white_check_mark:' || ':no_entry_sign:' }}" >> $GITHUB_STEP_SUMMARY + echo "- [Link to report](https://tyk-qa-reports.s3.eu-central-1.amazonaws.com/tyk-analytics/${{ github.run_id }}/index.html)" >> $GITHUB_STEP_SUMMARY - name: Generate metadata and upload test reports id: metadata_report if: always() && (steps.test_execution.conclusion != 'skipped') env: - REPORT_NAME: ${{ github.repository }}_${{ github.run_id }}_${{ github.run_attempt }}-${{steps.timestamp.outputs.ts}} + REPORT_NAME: ${{ github.repository }}_${{ github.run_id }}_${{ github.run_attempt }}-${{steps.env_up.outputs.ts}} METADATA_REPORT_PATH: metadata.toml run: | # Generate metadata report @@ -405,6 +418,7 @@ jobs: retention-days: 3 overwrite: true test-controller-distros: + if: github.event.pull_request.draft == false needs: - goreleaser runs-on: ubuntu-latest diff --git a/ci/goreleaser/goreleaser.yml b/ci/goreleaser/goreleaser.yml index b01e0c71137..361a5de29cd 100644 --- a/ci/goreleaser/goreleaser.yml +++ b/ci/goreleaser/goreleaser.yml @@ -9,6 +9,7 @@ builds: - id: std flags: - -tags=ignore + - -trimpath - -tags=goplugin ldflags: - -X github.com/TykTechnologies/tyk/internal/build.Version={{.Version}} @@ -23,6 +24,7 @@ builds: - id: fips flags: - -tags=ignore + - -trimpath - -tags=goplugin - -tags=fips,boringcrypto env: @@ -40,6 +42,7 @@ builds: - id: std-arm64 flags: - -tags=ignore + - -trimpath - -tags=goplugin ldflags: - -X github.com/TykTechnologies/tyk/internal/build.Version={{.Version}}