Skip to content

Commit

Permalink
feat(ci): move composer udpdate in CI (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
damcou authored May 12, 2022
1 parent 9e2cc89 commit 7f3d6ee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ playground
build
composer.json
tsconfig.json
vendor
7 changes: 7 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ runs:
shell: bash
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

- name: Run composer update
if: inputs.type != 'minimal'
shell: bash
run: |
composer update --working-dir=clients/algoliasearch-client-php
composer dump-autoload --working-dir=clients/algoliasearch-client-php
# Computing jobs that should run
- name: Setting diff outputs variables
if: inputs.type == 'matrix'
Expand Down
11 changes: 11 additions & 0 deletions scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,14 @@ export async function emptyDirExceptForDotGit(dir: string): Promise<void> {
}
}
}

export async function runComposerUpdate(verbose: boolean): Promise<void> {
if (!CI) {
await run(
'composer update --working-dir=clients/algoliasearch-client-php && composer dump-autoload --working-dir=clients/algoliasearch-client-php',
{
verbose,
}
);
}
}
3 changes: 2 additions & 1 deletion scripts/cts/runCts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CI, run } from '../common';
import { CI, run, runComposerUpdate } from '../common';
import { createSpinner } from '../oraLog';

async function runCtsOne(language: string, verbose: boolean): Promise<void> {
Expand All @@ -16,6 +16,7 @@ async function runCtsOne(language: string, verbose: boolean): Promise<void> {
});
break;
case 'php': {
await runComposerUpdate(verbose);
let php = 'php8';
if (CI) php = 'php';
await run(
Expand Down
7 changes: 3 additions & 4 deletions scripts/formatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CI, run } from './common';
import { CI, run, runComposerUpdate } from './common';
import { createSpinner } from './oraLog';

export async function formatter(
Expand All @@ -25,9 +25,8 @@ export async function formatter(
&& yarn prettier --write ${folder}`;
break;
case 'php':
cmd = `composer update --working-dir=clients/algoliasearch-client-php \
&& composer dump-autoload --working-dir=clients/algoliasearch-client-php \
&& yarn run prettier ${folder} --write \
await runComposerUpdate(verbose);
cmd = `yarn run prettier ${folder} --write \
&& PHP_CS_FIXER_IGNORE_ENV=1 ${
CI ? 'php' : 'php8'
} clients/algoliasearch-client-php/vendor/bin/php-cs-fixer fix ${folder} --using-cache=no --allow-risky=yes`;
Expand Down

0 comments on commit 7f3d6ee

Please sign in to comment.