Skip to content

chore: fix CTS artifact path #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
21 changes: 17 additions & 4 deletions scripts/ci/githubActions/createMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,21 @@ async function getClientMatrix(baseBranch: string): Promise<void> {
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,
Expand All @@ -97,7 +109,8 @@ async function getClientMatrix(baseBranch: string): Promise<void> {
`templates/${language}`,
`generators/src`,
]),
testsOutputPath: `${testOutputBase}/client ${testOutputBase}/methods`,
testsToDelete,
testsToStore,
});
console.log(`::set-output name=RUN_GEN_${language.toUpperCase()}::true`);
}
Expand Down
8 changes: 6 additions & 2 deletions scripts/ci/githubActions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 & {
Expand Down