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..2efb847bed 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -83,9 +83,21 @@ async function getClientMatrix(baseBranch: string): Promise { continue; } - const testOutputBase = `./tests/output/${language}/${getTestOutputFolder( - language - )}`; + 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, @@ -97,7 +109,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 & {