From 0d072d1bcb43ad690d12cb91db259910a3e9e71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 25 May 2022 18:01:56 +0200 Subject: [PATCH 1/2] chore: fix CTS artifact path --- .github/workflows/check.yml | 4 ++-- scripts/ci/githubActions/createMatrix.ts | 8 +++++++- scripts/ci/githubActions/types.ts | 8 ++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7f20d1cc68..cca7ae6d83 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -221,7 +221,7 @@ jobs: run: yarn cli build clients ${{ matrix.client.language }} ${{ matrix.client.toRun }} - name: Clean CTS output before generate - run: rm -rf ${{ matrix.client.testsOutputPath }} || true + run: rm -rf ${{ matrix.client.testsToDelete }} || true - name: Generate CTS run: yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }} @@ -230,7 +230,7 @@ jobs: run: yarn cli cts run ${{ matrix.client.language }} - name: Zip artifact before storing - run: zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsOutputPath }} -x "**/node_modules/**" "**/node_modules/.**" "clients/algoliasearch-client-javascript/.yarn/**" + run: zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} -x "**/node_modules/**" "**/node_modules/.**" "clients/algoliasearch-client-javascript/.yarn/**" - name: Store ${{ matrix.client.language }} clients uses: actions/upload-artifact@v3 diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index c87b420c54..7a67c3b7bb 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -86,6 +86,11 @@ async function getClientMatrix(baseBranch: string): Promise { const testOutputBase = `./tests/output/${language}/${getTestOutputFolder( language )}`; + const testsToDelete = `${testOutputBase}/client ${testOutputBase}/methods`; + const testsToStore = + language === 'javascript' + ? `${testsToDelete} ./tests/output/${language}/package.json` + : testsToDelete; clientMatrix.client.push({ language, @@ -97,7 +102,8 @@ async function getClientMatrix(baseBranch: string): Promise { `templates/${language}`, `generators/src`, ]), - testsOutputPath: `${testOutputBase}/client ${testOutputBase}/methods`, + testsToDelete, + testsToStore, }); console.log(`::set-output name=RUN_GEN_${language.toUpperCase()}::true`); } diff --git a/scripts/ci/githubActions/types.ts b/scripts/ci/githubActions/types.ts index 648eb92c50..1d232b6323 100644 --- a/scripts/ci/githubActions/types.ts +++ b/scripts/ci/githubActions/types.ts @@ -30,9 +30,13 @@ export type ClientMatrix = BaseMatrix & { */ language: string; /** - * The test output path to clean. + * The test output path to delete before running the CTS generation. */ - testsOutputPath: string; + testsToDelete: string; + /** + * The test output path to store in the artifact. + */ + testsToStore: string; }; export type SpecMatrix = BaseMatrix & { From 00bd85fda6d5ec5b3b15927469a86cb4381b4f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Wed, 25 May 2022 18:10:09 +0200 Subject: [PATCH 2/2] include java file --- scripts/ci/githubActions/createMatrix.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index 7a67c3b7bb..2efb847bed 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -83,14 +83,21 @@ async function getClientMatrix(baseBranch: string): Promise { continue; } - const testOutputBase = `./tests/output/${language}/${getTestOutputFolder( - language - )}`; - const testsToDelete = `${testOutputBase}/client ${testOutputBase}/methods`; - const testsToStore = - language === 'javascript' - ? `${testsToDelete} ./tests/output/${language}/package.json` - : testsToDelete; + const testsBasePath = `./tests/output/${language}`; + const testsOutputBase = `${testsBasePath}/${getTestOutputFolder(language)}`; + const testsToDelete = `${testsOutputBase}/client ${testsOutputBase}/methods`; + let testsToStore = testsToDelete; + + switch (language) { + case 'javascript': + testsToStore = `${testsToDelete} ${testsBasePath}/package.json`; + break; + case 'java': + testsToStore = `${testsToDelete} ${testsBasePath}/build.gradle`; + break; + default: + break; + } clientMatrix.client.push({ language,