Skip to content

Commit

Permalink
Merge branch 'main' into fix/specs-hits
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Jul 27, 2022
2 parents 40795d0 + bdef794 commit 07939e5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
6 changes: 0 additions & 6 deletions .github/actions/restore-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ runs:
shell: bash
run: |
rm -rf clients/algoliasearch-client-javascript
rm -rf tests/output/javascript/src/client || true
rm -rf tests/output/javascript/src/methods || true
unzip -q -o clients-javascript.zip && rm clients-javascript.zip
# PHP
Expand All @@ -87,8 +85,6 @@ runs:
shell: bash
run: |
rm -rf clients/algoliasearch-client-php
rm -rf tests/output/php/src/client || true
rm -rf tests/output/php/src/methods || true
unzip -q -o clients-php.zip && rm clients-php.zip
# Java
Expand All @@ -103,6 +99,4 @@ runs:
shell: bash
run: |
rm -rf clients/algoliasearch-client-java-2
rm -rf tests/output/java/src/test/java/com/algolia/client || true
rm -rf tests/output/java/src/test/java/com/algolia/methods || true
unzip -q -o clients-java.zip && rm clients-java.zip
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'javascript' }}
run: cd ${{ matrix.client.path }} && yarn workspace algoliasearch test

- name: Remove CTS output before generate
- name: Remove previous CTS output
run: rm -rf ${{ matrix.client.testsToDelete }} || true

- name: Generate CTS
Expand Down Expand Up @@ -278,7 +278,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.testsRootFolder }} -x "**/node_modules**" "**/.yarn/cache/**" "**/build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**"
run: zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} -x "**/node_modules**" "**/.yarn/cache/**" "**/build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**"

- name: Store ${{ matrix.client.language }} clients
uses: actions/upload-artifact@v3
Expand Down
22 changes: 16 additions & 6 deletions scripts/ci/githubActions/createMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,28 @@ async function getClientMatrix(baseBranch: string): Promise<void> {
const testsOutputBase = `${testsRootFolder}/${getTestOutputFolder(
language
)}`;
const testsToDelete = matrix[language].toRun
// We delete all tests because the CTS runs everything present in the folder
// but we then re-generate the ones that needs to run
const testsToDelete = `${testsOutputBase}/client ${testsOutputBase}/methods/requests`;

// We only store tests of clients that ran during this job, the rest stay as is
let testsToStore = matrix[language].toRun
.map((client) => {
const clientName = createClientName(client, language);
const extension = getTestExtension(language);
// REMOVE THIS IN NEXT PR !!
const oldPath =
language === 'php' ? createClientName(client, language) : client;
const tmpPath = `${testsOutputBase}/client/${oldPath}${extension} ${testsOutputBase}/methods/requests/${oldPath}${extension}`;

return `${testsOutputBase}/client/${clientName}${extension} ${testsOutputBase}/methods/requests/${clientName}${extension} ${tmpPath}`;
return `${testsOutputBase}/client/${clientName}${extension} ${testsOutputBase}/methods/requests/${clientName}${extension}`;
})
.join(' ');

switch (language) {
case 'java':
testsToStore = `${testsToStore} ${testsRootFolder}/build.gradle`;
break;
default:
break;
}

clientMatrix.client.push({
language,
path: matrix[language].path,
Expand All @@ -111,6 +120,7 @@ async function getClientMatrix(baseBranch: string): Promise<void> {
]),
testsRootFolder,
testsToDelete,
testsToStore,
});
console.log(`::set-output name=RUN_GEN_${language.toUpperCase()}::true`);
}
Expand Down
4 changes: 4 additions & 0 deletions scripts/ci/githubActions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export type ClientMatrix = BaseMatrix & {
* The test output path to delete before running the CTS generation.
*/
testsToDelete: string;
/**
* The test output path to store in the artifact.
*/
testsToStore: string;
};

export type SpecMatrix = Pick<BaseMatrix, 'cacheKey' | 'toRun'> & {
Expand Down

0 comments on commit 07939e5

Please sign in to comment.