Skip to content

feat(ci): move composer udpdate in CI #495

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 3 commits into from
May 12, 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
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 @@ -284,3 +284,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