Skip to content

RE-2527 use go specific sonarqube action (#71) #22

RE-2527 use go specific sonarqube action (#71)

RE-2527 use go specific sonarqube action (#71) #22

Workflow file for this run

name: push-master
on:
push:
branches:
- master
env:
PACKAGES: "./..."
jobs:
init:
runs-on: ubuntu-latest
outputs:
matrix_packages: ${{ steps.set-matrix-packages.outputs.matrix_packages }}
lint_args_packages: ${{ steps.set-matrix-packages.outputs.lint_args_packages }}
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set matrix packages
id: set-matrix-packages
shell: bash
env:
PACKAGES: ${{ env.PACKAGES }}
run: |
matrix_packages=$(echo "${PACKAGES}" | jq -R 'split(",")' | tr -d "\n\t")
echo "matrix_packages=${matrix_packages}" | tee -a "${GITHUB_OUTPUT}"
- name: Set lint args packages
id: set-lint-args-packages
shell: bash
env:
PACKAGES: ${{ env.PACKAGES }}
run: echo "lint_args_packages=$(echo "./$(echo $PACKAGES | sed 's/,/\/... .\//g;s/$/\/.../')")" | tee -a "${GITHUB_OUTPUT}"
ci-lint:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: ci-lint
uses: smartcontractkit/.github/actions/ci-lint-go@5b1046c28343660ecb84844c6fa95a66d1cdb52e # ci-lint-go@0.2.1
with:
# grafana inputs
metrics-job-name: ci-lint
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
# env inputs
use-env-files: "true"
env-files: ./tools/env/ci.env
# go inputs
use-go-cache: true
go-cache-dep-path: "**/go.sum"
go-version-file: go.mod
golangci-lint-version: "v1.55.2"
golangci-lint-args: --out-format colored-line-number,checkstyle:golangci-lint-report.xml
ci-test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: ci-test
uses: smartcontractkit/.github/actions/ci-test-go@5b1046c28343660ecb84844c6fa95a66d1cdb52e # ci-test-go@0.1.2
with:
# grafana inputs
metrics-job-name: ci-test
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
# docker inputs
use-docker-compose: "true"
docker-compose-workdir: ./tools/docker/setup-postgres
# env inputs
use-env-files: "true"
env-files: ./tools/env/ci.env
# go inputs
use-go-cache: "true"
go-cache-dep-path: "**/go.sum"
go-version-file: go.mod
go-test-cmd: make test-ci
ci-sonarqube:
needs: [ci-lint, ci-test]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: ci-sonarqube
uses: smartcontractkit/.github/actions/ci-sonarqube-go@3e11dbc45e4c8b18dd996fb417ccf22056176388 # ci-sonarqube-go@0.1.0
with:
# grafana inputs
metrics-job-name: ci-sonarqube
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
# sonarqube inputs
sonar-token: ${{ secrets.SONAR_TOKEN }}
sonar-host-url: ${{ secrets.SONAR_HOST_URL }}
cd-release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
changesets_published: ${{ steps.cd-release.outputs.published }}
changesets_publishedPackages: ${{ steps.cd-release.outputs.publishedPackages }}
steps:
- name: cd-release
id: cd-release
uses: smartcontractkit/.github/actions/cicd-changesets@5b1046c28343660ecb84844c6fa95a66d1cdb52e # cicd-changesets@0.2.2
with:
# general inputs
git-user: app-token-issuer-foundations[bot]
git-email: app-token-issuer-foundations[bot]@users.noreply.github.com
pnpm-use-cache: false
# aws inputs
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_CHAINLINK_FEEDS_CI_CHANGESET_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.AWS_FOUNDATIONS_GATI_URL }}
# grafana inputs
metrics-job-name: cd-release
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
cicd-build-publish-artifacts-release:
# Call push-tag-release for median@7.7.7
name: Call push-tag-release for ${{ matrix.package.name }}@${{ matrix.package.version }}
if: needs.cd-release.outputs.changesets_published == 'true'
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.cd-release.outputs.changesets_publishedPackages) }}
permissions:
id-token: write
contents: write
actions: read
needs: [cd-release]
uses: ./.github/workflows/push-tag-release.yml
secrets: inherit
with:
tag: "${{ matrix.package.name }}@${{ matrix.package.version }}"