Skip to content

Fixes & chain improvements #498

Fixes & chain improvements

Fixes & chain improvements #498

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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
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@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0
with:
id: unit-tests-${{ matrix.shardIndex }}-of-${{ matrix.shardTotal }}
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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0 # required by CodCov
- name: Setup node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
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@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: unit-tests-coverage-${{ matrix.shardIndex }}
path: ./coverage/${{matrix.shardIndex}}_lcov.info
sonarqube:
name: SonarQube Scan
needs: [eslint, unit-tests]
runs-on: ubuntu-latest
if: always()
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
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@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- 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@53c3e3207fe4b8d52e2f1ac9d6eb1d2506f626c0 # v2.0.2
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 }}