Skip to content

chore: grafana internal credentials #377

chore: grafana internal credentials

chore: grafana internal credentials #377

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
eslint:
name: ESLint (non-blocking)
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version-file: .tool-versions
cache: yarn
- name: Run yarn install
run: yarn install --frozen-lockfile
- name: Setup project
run: yarn setup
env:
GH_TOKEN: ${{ github.token }}
- name: Run eslint
run: yarn run lint -f json -o eslint-report.json
- name: Upload ESLint report
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: eslint-report
path: ./eslint-report.json
unit-tests:
strategy:
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
name: Unit Tests ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
runs-on: ubuntu-latest
steps:
- name: Collect Metrics
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@0281b09807758be1dcc41651e44e62b353808c47 # v2.1.0
with:
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: Unit Tests ${{ matrix.shardIndex }}
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0 # required by CodCov
- name: Setup node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version-file: .tool-versions
cache: yarn
- name: Run yarn install
run: yarn install --frozen-lockfile
- name: Setup project
run: yarn setup
env:
GH_TOKEN: ${{ github.token }}
- name: Run tests
run: yarn run test:ci --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: Upload CodCov coverage report
run: ./bin/codecov -s ./coverage
- name: Rename unit-test coverage report as belonging to the shard ${{ matrix.shardIndex }}
run: mv coverage/lcov.info coverage/${{matrix.shardIndex}}_lcov.info
- name: Upload unit-test coverage report
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: unit-tests-coverage
path: ./coverage/${{matrix.shardIndex}}_lcov.info
sonarqube:
name: SonarQube Scan
needs: [eslint, unit-tests]
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports
- name: Download all reports
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
- name: Update ESLint report symlinks
run: sed -i 's+/home/runner/work/operator-ui/operator-ui/+/github/workspace/+g' ./eslint-report/eslint-report.json
- name: Set SonarQube Reports Paths
id: sonarqube_report_paths
shell: bash
run: |
echo "sonarqube_coverage_report_paths=$(find -type f -name '*_lcov.info' -printf "%p,")" >> $GITHUB_OUTPUT
echo "sonarqube_eslint_report_paths=$(find -type f -name 'eslint-report.json' -printf "%p,")" >> $GITHUB_OUTPUT
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@69c1a75940dec6249b86dace6b630d3a2ae9d2a7 # v2.0.1
with:
args: >
-Dsonar.javascript.lcov.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }}
-Dsonar.eslint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}