From bdda7cfec733405dc8083ddf6a50c0bf4567b841 Mon Sep 17 00:00:00 2001 From: Faith Kangai Date: Tue, 12 Nov 2024 13:52:46 +0300 Subject: [PATCH] =?UTF-8?q?Add=20check=20for=20sonar=20token=20and=20make?= =?UTF-8?q?=20output=20path=20in=20tests=20platform=20agno=E2=80=A6=20(#57?= =?UTF-8?q?58)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add check for sonar token and make output path in tests platform agnostic * make the if sonar token is set requirement more task-specific --- .github/workflows/build-vscode-extension.yml | 12 ++++++++++++ .../suite/commands/generateClientCommand.test.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index ee28133534..7b9742750e 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -10,7 +10,18 @@ permissions: contents: read jobs: + checksecret: + name: check if SONAR_TOKEN is set in github secrets + runs-on: ubuntu-latest + outputs: + is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }} + steps: + - name: Check whether unity activation requests should be done + id: checksecret_job + run: | + echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT build_extension: + needs: [checksecret] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -40,6 +51,7 @@ jobs: run: npm run test-with-coverage working-directory: vscode/microsoft-kiota - name: Run sonar cloud analysis + if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true' uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any diff --git a/vscode/microsoft-kiota/src/test/suite/commands/generateClientCommand.test.ts b/vscode/microsoft-kiota/src/test/suite/commands/generateClientCommand.test.ts index 7f15478fb7..edc0337b60 100644 --- a/vscode/microsoft-kiota/src/test/suite/commands/generateClientCommand.test.ts +++ b/vscode/microsoft-kiota/src/test/suite/commands/generateClientCommand.test.ts @@ -217,7 +217,7 @@ suite('GenerateClientCommand Test Suite', () => { //stub and call generateCommand const generateClientCommand = new generateModule.GenerateClientCommand(treeProvider, context, viewProvider, setWorkspaceGenerationContext); - var outputPath = "path/to/temp/folder/appPackage"; + var outputPath = path.join("path", "to", "temp", "folder", "appPackage"); //make it os agnostic const generateManifestAndRefreshUIExpectation = sinon.mock(generateClientCommand).expects( "generateManifestAndRefreshUI").twice().withArgs( config, extensionSettings, outputPath, ["repairs"]