Skip to content

Commit

Permalink
chore(ci): run the macos jobs in parallel [skip-bc] (#4171)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Nov 26, 2024
1 parent b69c3c8 commit 3b61cf7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
38 changes: 21 additions & 17 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ jobs:
run: cd clients/algoliasearch-client-javascript && YARN_ENABLE_HARDENED_MODE=0 YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

- name: Build clients
run: ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).buildCommand }}
run: cd clients/algoliasearch-client-javascript && yarn build

- name: Build the playground
run: yarn cli build playground javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
Expand Down Expand Up @@ -334,6 +334,8 @@ jobs:
- name: Generate clients
run: yarn cli generate ${{ matrix.client.language }} ${{ matrix.client.toRun }}

# no need to build the clients here, it will be done in the Run CTS step anyway.

- name: Update composer.lock
if: ${{ matrix.client.language == 'php' && startsWith(github.head_ref, 'chore/renovateBaseBranch') && matrix.client.isMainVersion }}
run: cd ${{ matrix.client.path }} && composer update
Expand All @@ -346,9 +348,6 @@ jobs:
find Sources -type f | rev | cut -d '/' -f1 | rev | sort | uniq -d
[ $(find Sources -type f | rev | cut -d '/' -f1 | rev | sort | uniq -d | wc -l) -gt 0 ] && echo "Duplicates found" && exit 1 || echo "No duplicate found"
- name: Build clients
run: ${{ matrix.client.buildCommand }}

- name: Build the playground
run: yarn cli build playground ${{ matrix.client.language }}

Expand Down Expand Up @@ -419,7 +418,8 @@ jobs:
runs-on: macos-latest
needs:
- setup
- client_gen
- specs
- scripts
if: |
always() &&
needs.setup.outputs.RUN_GEN == 'true' &&
Expand All @@ -432,18 +432,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Download artifacts
- name: Download specs artifacts
uses: ./scripts/ci/actions/restore-artifacts
with:
type: languages
languages: |
kotlin
type: specs

- name: Setup
uses: ./.github/actions/setup
with:
type: minimal
language: kotlin
version: ${{ fromJSON(needs.setup.outputs.KOTLIN_DATA).version }}

- name: Generate clients
run: yarn cli generate kotlin ${{ fromJSON(needs.setup.outputs.KOTLIN_DATA).toRun }}

- name: Build clients for macOS
id: build
Expand All @@ -463,7 +464,8 @@ jobs:
runs-on: macos-latest
needs:
- setup
- client_gen
- specs
- scripts
if: |
always() &&
needs.setup.outputs.RUN_GEN == 'true' &&
Expand All @@ -481,22 +483,24 @@ jobs:
- uses: actions/checkout@v4
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}

- name: Download artifacts
- name: Download specs artifacts
uses: ./scripts/ci/actions/restore-artifacts
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
with:
type: languages
languages: |
swift
type: specs

- name: Setup
uses: ./.github/actions/setup
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
with:
type: minimal
language: swift
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}

- name: Generate clients
run: yarn cli generate swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }}

- name: Generate tests
run: yarn cli cts generate swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }}

- name: Run tests on macOS
id: run-test
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci/githubActions/createMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
language,
path: matrix[language].path,
toRun,
buildCommand: `yarn cli build clients ${language} ${toRun}`,
testsRootFolder,
// We delete tests to ensure the CI only run tests against what changed.
testsToDelete: `${testsOutputBase}/client ${testsOutputBase}/requests ${testsOutputBase}/e2e ${testsOutputBase}/benchmark`,
Expand Down Expand Up @@ -112,7 +111,6 @@ async function createClientMatrix(baseBranch: string): Promise<void> {
languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/build.gradle`;
break;
case 'javascript':
languageMatrix.buildCommand = `cd ${matrix[language].path} && yarn build`;
languageMatrix.testsToStore = `${languageMatrix.testsToStore} ${testsRootFolder}/package.json`;

setOutput('JAVASCRIPT_DATA', JSON.stringify(languageMatrix));
Expand Down
4 changes: 0 additions & 4 deletions scripts/ci/githubActions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ export type ClientMatrix = {
* The client language.
*/
language: string;
/**
* The command to build the clients.
*/
buildCommand: string;
/**
* The root of the test folder.
*/
Expand Down

0 comments on commit 3b61cf7

Please sign in to comment.