Skip to content

Commit

Permalink
Adding ESLint to sonar (#544)
Browse files Browse the repository at this point in the history
* Adding eslint
  • Loading branch information
smickovskid authored Sep 22, 2023
1 parent 969b635 commit aa9120e
Show file tree
Hide file tree
Showing 6 changed files with 559 additions and 8 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/gauntlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@ jobs:
- name: Lint
run: yarn --cwd ./gauntlet lint:format

gauntlet_eslint:
name: Gauntlet ESLint
env:
CI: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Install Nix
uses: cachix/install-nix-action@29bd9290ef037a3ecbdafe83cbd2185e9dd0fa0a # v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: "sandbox = false"
- name: Cache Nix
uses: cachix/cachix-action@v12
with:
name: chainlink-cosmos
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix develop -c yarn --cwd ./gauntlet install --frozen-lockfile
- run: nix develop -c yarn --cwd ./gauntlet eslint
- name: Upload eslint report
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: gauntlet-eslint-report
path: ./gauntlet/eslint-report.json

gauntlet_run_tests:
name: Gauntlet Run Tests
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ jobs:
name: go-relay-test-results
if_no_artifact_found: warn

- name: Download gauntlet eslint reports
uses: dawidd6/[email protected]
with:
workflow: gauntlet.yml
workflow_conclusion: ""
name_is_regexp: true
name: gauntlet-eslint-report
if_no_artifact_found: warn

- name: Set SonarQube Report Paths
id: sonarqube_report_paths
shell: bash
Expand All @@ -96,15 +105,22 @@ jobs:
echo "sonarqube_tests_report_paths=$(find . -type f -name output.txt | paste -sd "," -)"
echo "sonarqube_coverage_report_paths=$(find . -type f -name '*coverage.txt' | paste -sd "," -)"
echo "sonarqube_golangci_report_paths=$(find . -type f -name 'golangci-*-report.xml' -printf "%p,")"
echo "sonarqube_eslint_report_paths=$(find -type f -name 'eslint-report.json' -printf "%p")" >> $GITHUB_OUTPUT
} >> "$GITHUB_OUTPUT"
- name: Update ESLint report symlinks
continue-on-error: true
run: sed -i 's+/home/runner/work/feeds-manager/feeds-manager/+/github/workspace/+g' ${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }}


- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@a6ba0aafc293e03de5437af7edbc97f7d3ebc91a # v1.2.0
with:
args: >
-Dsonar.go.tests.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_tests_report_paths }}
-Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }}
-Dsonar.go.golangci-lint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_golangci_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 }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ tests-smoke-report.xml
*report.json
*.out
*coverage*
eslint-report.json
20 changes: 20 additions & 0 deletions gauntlet/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}
4 changes: 4 additions & 0 deletions gauntlet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"gauntlet": "yarn build && node ./packages/gauntlet-solana-contracts/dist/cli.js",
"gauntlet-serum-multisig": "yarn build && node ./packages/gauntlet-serum-multisig/dist/index.js",
"lint": "tsc -b ./tsconfig.json",
"eslint": "eslint -f json -o eslint-report.json ./packages || true",
"test": "yarn build && SKIP_PROMPTS=true jest --runInBand ./packages",
"test:coverage": "yarn test --collectCoverage",
"test:ci": "yarn test --ci",
Expand Down Expand Up @@ -48,6 +49,9 @@
"@types/jest": "^26.0.15",
"@types/node": "^14.11.2",
"@types/secp256k1": "^4.0.3",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"eslint": "^8.49.0",
"jest": "^26.6.3",
"pkg": "^5.2.1",
"prettier": "2.1.1",
Expand Down
Loading

0 comments on commit aa9120e

Please sign in to comment.