Skip to content
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

Refactor PR workflow into separate test jobs #6746

Merged
merged 18 commits into from
Jun 24, 2024
Merged

Conversation

kraenhansen
Copy link
Member

@kraenhansen kraenhansen commented Jun 21, 2024

What, How & Why?

My work on #6742 turned into a refactor of the PR workflow separating the test job into three, each depending only on the jobs producing the artifacts they need. Taking us one step closer towards #6530.

  • This makes it possible for the tests to start as soon as the artefacts they depend on become available (such that the iOS tests doesn't have to wait for the Node.js prebuilds and vice-versa).
  • It also means, that if the prebuild of the Node native module fails the job can be re-run without the iOS tests having to re-run if they already passed.
  • I figured out the reason and fixed the issue with our iOS test app not utilizing ccache and shaved off ⅓ (~ 10 minutes) of the runtime on that 🏃💨
  • I also managed to remove a few workarounds and unneeded steps in the process.

@kraenhansen kraenhansen added T-Internal no-changelog no-jira-ticket Skip checking the PR title for Jira reference labels Jun 21, 2024
@kraenhansen kraenhansen self-assigned this Jun 21, 2024
@cla-bot cla-bot bot added the cla: yes label Jun 21, 2024
Comment on lines -137 to -140
- name: Get NPM cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed as this is already handled by actions/setup-node@v4.

@@ -131,23 +138,9 @@ jobs:
- name: Setup node version
uses: actions/setup-node@v4
with:
node-version: 20.11.1
Copy link
Member Author

@kraenhansen kraenhansen Jun 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was for a workaround in prebuild which is not released and this PR includes an upgrade to get the fix: prebuild/prebuild#325

Comment on lines -355 to -358
# On CI, file timestamps change with every run so instead rely on file content hashing
# https://reactnative.dev/docs/build-speed#using-this-approach-on-a-ci
- name: Configure ccache
run: ccache --set-config="compiler_check=content"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already handled by hendrikmuhs/ccache-action@v1.


- name: Create Mocha Remote Context
id: mocha-env
run: echo "context=syncLogLevel=warn,longTimeoutMs=${{ env.LONG_TIMEOUT }},baseUrl=${{ steps.baas.outputs.baas-url }}" >> $GITHUB_OUTPUT
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little annoying that this is now duplicated in the workspace code 🤔

Comment on lines +573 to +579
# Because the Xcode project injects its own CCACHE_CONFIGPATH,
# the configuration set by the ccache action doesn't propagate.
- name: Expose Ccache config to Xcode
run: |
echo "CCACHE_DIR=`ccache --get-config cache_dir`" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=`ccache --get-config max_size`" >> $GITHUB_ENV
echo "CCACHE_COMPILERCHECK=`ccache --get-config compiler_check`" >> $GITHUB_ENV
Copy link
Member Author

@kraenhansen kraenhansen Jun 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the fix for the main issue.

@@ -109,7 +109,7 @@
}
},
"pod-install:ci": {
"command": "pod-install",
"command": "cd ios && pod install --verbose",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helped me debug the progress and just gives a bit more output.

@@ -336,7 +336,7 @@
"cross-env": "^7.0.3",
"glob": "^10.3.12",
"mocha": "^10.1.0",
"prebuild": "^12.1.0",
"prebuild": "^13.0.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the note above on upgrading "node".

Comment on lines -505 to -511
# Hermes doesn't work with Cocoapods 1.15.0
# https://forums.developer.apple.com/forums/thread/745518
- name: Install older Cocoapods version
if: ${{ matrix.variant.os == 'ios' }}
uses: maxim-lobanov/setup-cocoapods@v1
with:
version: 1.14.3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got fixed in 1.15.2 which is now installed on the runner and there's no need for the workaround anymore.

@kraenhansen kraenhansen marked this pull request as ready for review June 22, 2024 10:15
Copy link
Contributor

@gagik gagik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Quicker CI is always great 🚀

node-electron-tests:
name: Test ${{ matrix.environment }} on ${{ matrix.runner }} (${{matrix.script_name}})
needs:
- generate-jsi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is JSI needed for node? Shouldn't it be node-prebuild?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch - generate-jsi is not needed for the Node / Electron tests 👍

Copy link
Member

@elle-j elle-j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be very helpful!

@kraenhansen kraenhansen merged commit 1b24533 into main Jun 24, 2024
32 checks passed
@kraenhansen kraenhansen deleted the kh/separate-pr-workflow branch June 24, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes no-changelog no-jira-ticket Skip checking the PR title for Jira reference T-Internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants