Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ESLint to Sonar #327

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .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": {
}
}
26 changes: 26 additions & 0 deletions .github/workflows/integration_gauntlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ on:
pull_request:

jobs:
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 install --frozen-lockfile
- run: nix develop -c yarn eslint
- name: Upload eslint report
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: gauntlet-eslint-report
path: ./eslint-report.json

integration_gauntlet_run_tests:
name: Run Tests
runs-on: ubuntu-latest
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
max-timeout: "1200"
polling-interval: "30"
exclude-workflow-names: "Amarna Analysis,Changesets,Integration Contracts (Vendor, Examples),Integration Gauntlet,Integration Tests Publish,Integration Tests - Smoke,Integration Tests - Soak,Build and push on-chain monitor image to ECR,Contracts,Lint"
exclude-workflow-names: "Amarna Analysis,Changesets,Integration Contracts (Vendor, Examples),Integration Tests Publish,Integration Tests - Smoke,Integration Tests - Soak,Build and push on-chain monitor image to ECR,Contracts,Lint"
exclude-workflow-ids: ""
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
Expand Down Expand Up @@ -76,6 +76,15 @@ jobs:
name: golangci-lint-integration-tests-report
if_no_artifact_found: warn

- name: Download gauntlet eslint reports
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: integration_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 @@ -84,14 +93,21 @@ 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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,4 @@ integration-tests/smoke/logs
integration-tests/soak/logs
remote.test
ztarrepo.tar.gz
eslint-report.json
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test": "yarn build && yarn workspaces run test",
"test:coverage": "yarn test --collectCoverage",
"test:ci": "yarn test --ci",
"eslint": "eslint -f json -o eslint-report.json ./packages-ts || true",
"lint": "tsc -b ./tsconfig.json",
"format": "yarn prettier --write .",
"format:check": "yarn prettier --check .",
Expand Down Expand Up @@ -46,6 +47,9 @@
"@changesets/cli": "^2.22.0",
"@types/jest": "^28.1.0",
"@types/node": "^18.7.11",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"eslint": "^8.49.0",
"jest": "^28.1.0",
"pkg": "^5.2.1",
"prettier": "2.1.1",
Expand Down
Loading
Loading