From dc609f50797d9d49e9bac9691e1c523e667330f1 Mon Sep 17 00:00:00 2001 From: Felix Schulze Date: Sun, 18 Aug 2024 20:14:17 +0200 Subject: [PATCH] add linting, sonarqube, renovate --- .gitea/workflows/lint.yml | 29 +++++++++++++++++++++++++++++ .gitea/workflows/sonarqube.yml | 33 +++++++++++++++++++++++++++++++++ .vscode/settings.json | 6 ++++++ renovate.json | 11 +++++++++++ sonar-project.properties | 5 +++++ 5 files changed, 84 insertions(+) create mode 100644 .gitea/workflows/lint.yml create mode 100644 .gitea/workflows/sonarqube.yml create mode 100644 .vscode/settings.json create mode 100644 renovate.json create mode 100644 sonar-project.properties diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..3f378e7 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,29 @@ +name: Lint + +on: + pull_request: + push: + branches: + - "**" # matches every branch + - "!dev" # excludes dev + - "!main" # excludes main + +jobs: + eslint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "npm" + - run: npm i + - uses: sibiraj-s/action-eslint@v3.0.1 + with: + eslint-args: "--ignore-path=.gitignore --quiet" + extensions: "js,jsx,ts,tsx" + annotations: true + all-files: true diff --git a/.gitea/workflows/sonarqube.yml b/.gitea/workflows/sonarqube.yml new file mode 100644 index 0000000..bc442d6 --- /dev/null +++ b/.gitea/workflows/sonarqube.yml @@ -0,0 +1,33 @@ +on: + push: + branches: + - main + - dev + - "!renovate/**" + pull_request: + types: [opened, synchronize, reopened] + +name: SonarQube Scan +jobs: + sonarqube: + name: SonarQube Trigger + runs-on: ubuntu-latest + steps: + - name: Checking out + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: SonarQube Scan + uses: SonarSource/sonarqube-scan-action@0c0f3958d90fc466625f1d1af1f47bddd4cc6bd1 # v3.0.0 + env: + SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + + # Check the Quality Gate status. + - name: SonarQube Quality Gate check + uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 2 + env: + SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} + SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7d242cc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "sonarlint.connectedMode.project": { + "connectionId": "https-sonarqube-schulze-network", + "projectKey": "trackevery.day" + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..9a353c0 --- /dev/null +++ b/renovate.json @@ -0,0 +1,11 @@ +{ + "extends": ["config:best-practices", ":semanticCommits"], + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "packageRules": [ + { + "matchUpdateTypes": ["minor", "patch", "pin", "digest"], + "automerge": true, + "automergeType": "branch" + } + ] +} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..911ea42 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,5 @@ +sonar.projectKey=trackevery.day + +# relative paths to source directories. More details and properties are described +# at https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/ +sonar.sources=. \ No newline at end of file