From 46841ec383aa608ec48db76cdfe1e1e79983b1b3 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:07:34 -0800 Subject: [PATCH 01/19] feat(tools): set up sonar --- .gitea/workflows/ci.yml | 43 +++++++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 6 ++++++ 2 files changed, 49 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .vscode/settings.json diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..c7e9b9a --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,43 @@ +name: Node.js CI +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + name: Lint and Test + + steps: + - name: Checkout Source Files + uses: actions/checkout@v4 + + - name: Use Node.js v22 + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 10 + + - name: Install Dependencies + run: pnpm install + + - name: Lint Source Files + run: pnpm run lint + + - name: Verify Build + run: pnpm run build + + - name: Run Tests + run: pnpm run test + + - name: Sonar + run: /home/naomi/sonar/bin/sonar-scanner -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c47903d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "sonarlint.connectedMode.project": { + "connectionId": "Naomi", + "projectKey": "typescript-config" + } +} \ No newline at end of file -- 2.47.2 From f4d74be56d0ff62c74f01361ee2141e15af8f3fb Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:08:31 -0800 Subject: [PATCH 02/19] fix: we don't need lint or build on this repo --- .gitea/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c7e9b9a..7927889 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -28,12 +28,6 @@ jobs: - name: Install Dependencies run: pnpm install - - name: Lint Source Files - run: pnpm run lint - - - name: Verify Build - run: pnpm run build - - name: Run Tests run: pnpm run test -- 2.47.2 From 22b399f117767eb2ee8f6f18040a7b1b8eb2affe Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:09:26 -0800 Subject: [PATCH 03/19] fix: pnpm version --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 7927889..f37d5e9 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v2 with: - version: 10 + version: 9 - name: Install Dependencies run: pnpm install -- 2.47.2 From b9a5dd09146c000cc8e30bdc6b09c914887eb606 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:12:28 -0800 Subject: [PATCH 04/19] fix: use global bindary --- .gitea/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f37d5e9..78c27d3 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,6 +32,6 @@ jobs: run: pnpm run test - name: Sonar - run: /home/naomi/sonar/bin/sonar-scanner -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com + run: sonar-scanner -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -- 2.47.2 From fa7f7ec138bc53307049783a1bb0f6c5affefcd3 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:17:35 -0800 Subject: [PATCH 05/19] feat: let's just install it as npm module? --- .gitea/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 78c27d3..f65b848 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -31,6 +31,9 @@ jobs: - name: Run Tests run: pnpm run test + - name: Prep Sonar + run: pnpm i @sonar/scan + - name: Sonar run: sonar-scanner -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com env: -- 2.47.2 From 74f236239a552988bfdef6e8bac5e4308c020886 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:18:38 -0800 Subject: [PATCH 06/19] fix: try this --- .gitea/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f65b848..bd0a062 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -31,10 +31,7 @@ jobs: - name: Run Tests run: pnpm run test - - name: Prep Sonar - run: pnpm i @sonar/scan - - name: Sonar - run: sonar-scanner -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com + run: npx @sonar/scan -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -- 2.47.2 From 4bdd44f97b981eba3a2cff812469b4a15805938b Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:19:59 -0800 Subject: [PATCH 07/19] fix: token as cli arg --- .gitea/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index bd0a062..f7eab6b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,6 +32,4 @@ jobs: run: pnpm run test - name: Sonar - run: npx @sonar/scan -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: npx @sonar/scan -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com -Dsonar.token={{ secrets.SONAR_TOKEN }} -- 2.47.2 From 8caac6e3c1e60afc42f9f74b68358c5163e59a3c Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:21:37 -0800 Subject: [PATCH 08/19] fix: like this? --- .gitea/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f7eab6b..e4d8474 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,4 +32,6 @@ jobs: run: pnpm run test - name: Sonar - run: npx @sonar/scan -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com -Dsonar.token={{ secrets.SONAR_TOKEN }} + run: npx @sonar/scan -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com -Dsonar.token=$SONAR_TOKEN + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -- 2.47.2 From fc1920329c30003c79843d224ada5a89220ecbc8 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:24:00 -0800 Subject: [PATCH 09/19] fix: there's an action????? fuck yeah --- .gitea/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e4d8474..e06924d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -32,6 +32,8 @@ jobs: run: pnpm run test - name: Sonar - run: npx @sonar/scan -Dsonar.prjectKey=typescript-config -Dsonar.sources=. -Dsonar.host.url=https://quality.nhcarrigan.com -Dsonar.token=$SONAR_TOKEN + uses: SonarSource/sonarqube-scan-action@v4 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: "https://quality.nhcarrigan.com" + SONAR_PROJECT_KEY: "typescript-config" -- 2.47.2 From 8a7dac73c92f2d086b73d511ad0f8c3d638090f4 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:27:16 -0800 Subject: [PATCH 10/19] fix: args --- .gitea/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e06924d..1adf61d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -36,4 +36,6 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: "https://quality.nhcarrigan.com" - SONAR_PROJECT_KEY: "typescript-config" + args: > + -Dsonar.sources=. + -Dsonar.projectKey=typescript-config -- 2.47.2 From 3e7245c944417b00f14fcf9bea31e9bdb3cdc70c Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:29:40 -0800 Subject: [PATCH 11/19] fix: allow time? --- .gitea/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 1adf61d..faa3be6 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: - name: Sonar uses: SonarSource/sonarqube-scan-action@v4 + timeout-minutes: 10 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: "https://quality.nhcarrigan.com" -- 2.47.2 From 792594ca8fff2f605220b0a733c279981ffa72cb Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:31:30 -0800 Subject: [PATCH 12/19] fix: args syntax --- .gitea/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index faa3be6..12707c0 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: "https://quality.nhcarrigan.com" - args: > - -Dsonar.sources=. - -Dsonar.projectKey=typescript-config + with: + args: > + -Dsonar.sources=. + -Dsonar.projectKey=typescript-config -- 2.47.2 From 08d04c1bb932620bec82f7f8b9474842292a5e17 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:36:44 -0800 Subject: [PATCH 13/19] fix: include branch? --- .gitea/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 12707c0..a054a38 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -41,3 +41,4 @@ jobs: args: > -Dsonar.sources=. -Dsonar.projectKey=typescript-config + -Dsonar.branch.name=${{ gitea.ref }} -- 2.47.2 From c6c4c73f23cd96c0bd18ff0054ef56f7bc45980b Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:41:33 -0800 Subject: [PATCH 14/19] fix: syntax? --- .gitea/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index a054a38..054ed06 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -37,8 +37,9 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: "https://quality.nhcarrigan.com" + REF: ${{ gitea.ref }} with: args: > -Dsonar.sources=. -Dsonar.projectKey=typescript-config - -Dsonar.branch.name=${{ gitea.ref }} + -Dsonar.branch.name=$REF -- 2.47.2 From 46f1beb2be35a316253b977bd5ea670474bbd3b0 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:46:29 -0800 Subject: [PATCH 15/19] feat: include pr info? --- .gitea/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 054ed06..d1d29ea 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -37,9 +37,10 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: "https://quality.nhcarrigan.com" - REF: ${{ gitea.ref }} with: args: > -Dsonar.sources=. -Dsonar.projectKey=typescript-config - -Dsonar.branch.name=$REF + -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} + -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} + -Dsonar.pullrequest.base=main -- 2.47.2 From 8ad1b295753170ae5bf712dd0db28de465e0a2e9 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:48:45 -0800 Subject: [PATCH 16/19] test: echo --- .gitea/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d1d29ea..e4deb3a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -31,6 +31,11 @@ jobs: - name: Run Tests run: pnpm run test + - name: Echo + run: | + echo "PR Number: ${{ github.event.pull_request.number }}" + echo "PR Branch: ${{ github.event.pull_request.head.ref }}" + - name: Sonar uses: SonarSource/sonarqube-scan-action@v4 timeout-minutes: 10 -- 2.47.2 From 2294275a8b1410abce0646032bf82bf7bbf7b582 Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:49:05 -0800 Subject: [PATCH 17/19] fix: indent --- .gitea/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e4deb3a..71d482c 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -33,8 +33,8 @@ jobs: - name: Echo run: | - echo "PR Number: ${{ github.event.pull_request.number }}" - echo "PR Branch: ${{ github.event.pull_request.head.ref }}" + echo "PR Number: ${{ github.event.pull_request.number }}" + echo "PR Branch: ${{ github.event.pull_request.head.ref }}" - name: Sonar uses: SonarSource/sonarqube-scan-action@v4 -- 2.47.2 From 657f80af5d40936deef1af470f98c5064feb35fd Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:52:56 -0800 Subject: [PATCH 18/19] feat: separate workflow files --- .gitea/workflows/ci.yml | 19 ------------------- .gitea/workflows/sonar-main.yml | 24 ++++++++++++++++++++++++ .gitea/workflows/sonar-pr.yml | 29 +++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 .gitea/workflows/sonar-main.yml create mode 100644 .gitea/workflows/sonar-pr.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 71d482c..66204d9 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -30,22 +30,3 @@ jobs: - name: Run Tests run: pnpm run test - - - name: Echo - run: | - echo "PR Number: ${{ github.event.pull_request.number }}" - echo "PR Branch: ${{ github.event.pull_request.head.ref }}" - - - name: Sonar - uses: SonarSource/sonarqube-scan-action@v4 - timeout-minutes: 10 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: "https://quality.nhcarrigan.com" - with: - args: > - -Dsonar.sources=. - -Dsonar.projectKey=typescript-config - -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} - -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} - -Dsonar.pullrequest.base=main diff --git a/.gitea/workflows/sonar-main.yml b/.gitea/workflows/sonar-main.yml new file mode 100644 index 0000000..33278b3 --- /dev/null +++ b/.gitea/workflows/sonar-main.yml @@ -0,0 +1,24 @@ +name: Code Analysis +on: + push: + branches: + - main + +jobs: + sonar: + name: SonarQube + + steps: + - name: Checkout Source Files + uses: actions/checkout@v4 + + - name: Sonar + uses: SonarSource/sonarqube-scan-action@v4 + timeout-minutes: 10 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: "https://quality.nhcarrigan.com" + with: + args: > + -Dsonar.sources=. + -Dsonar.projectKey=typescript-config diff --git a/.gitea/workflows/sonar-pr.yml b/.gitea/workflows/sonar-pr.yml new file mode 100644 index 0000000..235dc6a --- /dev/null +++ b/.gitea/workflows/sonar-pr.yml @@ -0,0 +1,29 @@ +name: Code Analysis +on: + pull_request: + branches: + - main + +jobs: + sonar: + name: SonarQube + + steps: + - name: Checkout Source Files + uses: actions/checkout@v4 + + - name: Sonar + uses: SonarSource/sonarqube-scan-action@v4 + timeout-minutes: 10 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: "https://quality.nhcarrigan.com" + PR_KEY: ${{ github.event.pull_request.number }} + PR_BRANCH: ${{ github.event.pull_request.head.ref }} + with: + args: > + -Dsonar.sources=. + -Dsonar.projectKey=typescript-config + -Dsonar.pullrequest.key=$PR_KEY + -Dsonar.pullrequest.branch=$PR_BRANCH + -Dsonar.pullrequest.base=main -- 2.47.2 From e1802d7c2703244f72d3dce4827e28f1ad5f58db Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 26 Feb 2025 12:57:17 -0800 Subject: [PATCH 19/19] feat: we can't use pr scanning on the free tier... Can't believe we have to pay for that even on a self-hosted instance. --- .gitea/workflows/sonar-main.yml | 24 ------------------------ .gitea/workflows/sonar-pr.yml | 10 +++++----- 2 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 .gitea/workflows/sonar-main.yml diff --git a/.gitea/workflows/sonar-main.yml b/.gitea/workflows/sonar-main.yml deleted file mode 100644 index 33278b3..0000000 --- a/.gitea/workflows/sonar-main.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Code Analysis -on: - push: - branches: - - main - -jobs: - sonar: - name: SonarQube - - steps: - - name: Checkout Source Files - uses: actions/checkout@v4 - - - name: Sonar - uses: SonarSource/sonarqube-scan-action@v4 - timeout-minutes: 10 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: "https://quality.nhcarrigan.com" - with: - args: > - -Dsonar.sources=. - -Dsonar.projectKey=typescript-config diff --git a/.gitea/workflows/sonar-pr.yml b/.gitea/workflows/sonar-pr.yml index 235dc6a..31fd31c 100644 --- a/.gitea/workflows/sonar-pr.yml +++ b/.gitea/workflows/sonar-pr.yml @@ -1,5 +1,8 @@ name: Code Analysis on: + push: + branches: + - main pull_request: branches: - main @@ -11,6 +14,8 @@ jobs: steps: - name: Checkout Source Files uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Sonar uses: SonarSource/sonarqube-scan-action@v4 @@ -18,12 +23,7 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: "https://quality.nhcarrigan.com" - PR_KEY: ${{ github.event.pull_request.number }} - PR_BRANCH: ${{ github.event.pull_request.head.ref }} with: args: > -Dsonar.sources=. -Dsonar.projectKey=typescript-config - -Dsonar.pullrequest.key=$PR_KEY - -Dsonar.pullrequest.branch=$PR_BRANCH - -Dsonar.pullrequest.base=main -- 2.47.2