Skip to content

Commit

Permalink
gen all
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed May 10, 2022
1 parent a9c9ce8 commit af092f4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ runs:
id: js-utils
shell: bash
run: |
if [[ ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JS_ALGOLIASEARCH_CHANGED > 0 }} ]]; then
if ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JS_ALGOLIASEARCH_CHANGED > 0 }}; then
echo "Running algoliasearch: true"
echo "::set-output name=RUN_JS_ALGOLIASEARCH::true"
fi
if [[ ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JAVASCRIPT_UTILS_CHANGED > 0 }} ]]; then
if ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JAVASCRIPT_UTILS_CHANGED > 0 }}; then
echo "Running JavaScript utils: true"
echo "::set-output name=RUN_JS_UTILS::true"
fi
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,13 @@ jobs:
- name: Generate CTS
run: yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}

- name: Check diff with pushed CTS
run: |
git --no-pager diff -- ${{ matrix.client.testsOutputPathToClean }}
exit $(git diff --name-only --diff-filter=d ${{ matrix.client.testsOutputPathToClean }} | wc -l)
- name: Run CTS
run: yarn cli cts run ${{ matrix.client.language }}

- name: Zip artifact before storing
run: zip -q -r clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} -x "${{ matrix.client.path }}/node_modules/.**"
run: |
zip -q -r clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} -x "${{ matrix.client.path }}/node_modules/.**"
zip -q -r clients-${{ matrix.client.language }}.zip ${{ matrix.client.testsOutputPathToClean }}
- name: Store ${{ matrix.client.language }} clients
uses: actions/upload-artifact@v3
Expand Down
9 changes: 9 additions & 0 deletions config/generation.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports = {
'!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/**',
'!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/**',

'tests/output/java/src/test/java/com/algolia/methods/**',
'tests/output/java/src/test/java/com/algolia/client/**',

// JavaScript
'!clients/algoliasearch-client-javascript/*',
'!clients/algoliasearch-client-javascript/.github/**',
Expand All @@ -26,6 +29,9 @@ module.exports = {
'!clients/algoliasearch-client-javascript/packages/requester-*/**',
'!clients/algoliasearch-client-javascript/packages/client-common/**',

'tests/output/java/src/test/java/com/algolia/methods/**',
'tests/output/java/src/test/java/com/algolia/client/**',

// PHP
'!clients/algoliasearch-client-php/*',
'!clients/algoliasearch-client-php/.*',
Expand All @@ -39,5 +45,8 @@ module.exports = {
'!clients/algoliasearch-client-php/lib/Support/**',
'!clients/algoliasearch-client-php/lib/Configuration/ConfigWithRegion.php',
'clients/algoliasearch-client-php/lib/Configuration/Configuration.php',

'tests/output/java/src/test/java/com/algolia/methods/**',
'tests/output/java/src/test/java/com/algolia/client/**',
],
};
13 changes: 5 additions & 8 deletions scripts/ci/codegen/pushGeneratedCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { getNbGitDiff } from '../utils';
import text from './text';

const PR_NUMBER = parseInt(process.env.PR_NUMBER || '0', 10);
const FOLDERS_TO_CHECK =
'yarn.lock config/openapitools.json clients specs/bundled';

async function isUpToDate(baseBranch: string): Promise<boolean> {
await run('git fetch origin');
Expand All @@ -33,7 +31,6 @@ export async function pushGeneratedCode(): Promise<void> {
const nbDiff = await getNbGitDiff({
branch: baseBranch,
head: null,
path: FOLDERS_TO_CHECK,
});

if (nbDiff === 0) {
Expand All @@ -46,7 +43,9 @@ export async function pushGeneratedCode(): Promise<void> {
return;
}

console.log(`${nbDiff} changes found for ${FOLDERS_TO_CHECK}`);
await run(`git --no-pager diff`, { verbose: true });

console.log(`${nbDiff} changes found`);

// determine generated branch name based on current branch
const branchToPush = isMainBranch ? baseBranch : `generated/${baseBranch}`;
Expand All @@ -72,10 +71,8 @@ export async function pushGeneratedCode(): Promise<void> {
Co-authored-by: %an <%ae>
%(trailers:key=Co-authored-by)"`);

console.log(
`Pushing code for folders '${FOLDERS_TO_CHECK}' to generated branch: '${branchToPush}'`
);
await run(`git add ${FOLDERS_TO_CHECK}`);
console.log(`Pushing code to generated branch: '${branchToPush}'`);
await run(`git add .`);
await run(`git commit -m "${commitMessage}"`);
await run(`git push origin ${branchToPush}`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[
{
"parameters": {
"indexName": "theIndexName"
"indexName": "theIndexNameff"
},
"request": {
"path": "/1/configs/theIndexName",
"path": "/1/configs/theIndexNameff",
"method": "DELETE"
}
}
Expand Down

0 comments on commit af092f4

Please sign in to comment.