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

Add support for Github Actions #881

Merged
merged 306 commits into from
Jan 30, 2024
Merged

Add support for Github Actions #881

merged 306 commits into from
Jan 30, 2024

Conversation

cmelchior
Copy link
Contributor

@cmelchior cmelchior commented Jun 8, 2022

Closes #878

This PR adds support for building the library on Github Actions, which is a step in us migrating off Jenkins.

TODO:

  • Parallize builds.
    • Be able to build only artifacts required for a specific host machine (Linux, Windows, Android, M1, MacOS)
    • Including Dokka in publications seems to trigger full builds of native code. Answer: It depends on the compile* tasks for some reason. So only publish metadata from Linux which avoids Gradle attempting to build all macos binaries in Core .
    • Be able to combine and publish JVM artifact with all supported platforms
  • Verify that we can release to Maven Central. (Snapshots work)
  • Rerunning commits does not seem to reuse caches effectively

Future tasks:

  • Measure build time to guide optimizations and caching. Some work has already been done, but I suspect it can be further improved.
  • Support for BAAS testing both on CI and locally. We should create some shell scripts we can run on either GHA or locally. Currently, these are hardcoded in the GHA scripts.
  • Support for Firebase Device testing on CI and locally. Currently only supported on GHA.

Dev notes

@cla-bot cla-bot bot added the cla: yes label Jun 8, 2022
@cmelchior cmelchior force-pushed the feature/github-actions branch 3 times, most recently from 80bc206 to 4423635 Compare August 18, 2022 08:28
Christian Melchior added 5 commits August 24, 2022 22:01
# Conflicts:
#	buildSrc/src/main/kotlin/Config.kt
#	gradle/wrapper/gradle-wrapper.jar
Squashed commits:
[5cc823b] Remember to checkout windows code
[fd14df3] Windows cache management
[83fbabc] Remove cache dir
[281d41f] Better flow control
[ba7e617] Cleanup
[1089f4e] More path
[b52078c] More path
[08dd96a] Windows
[52a2a81] use script root
[37602fc] Windows
[fde1daa] Setup vcpkg
[2eb5733] More windows
[a9eafc3] More windows
[a4e9d40] Attempt to fix windows cmake
[224b683] Use vcpkg toolchain from Realm Core
[fe89a9b] No need to delete folder as runner is clean
[6728a61] Powershell syntax
[eb953b3] Attempt to fix windows cmake
[a37e15e] jni libs should be built even if jni stub is skipped
[642be64] More cache attempts
[379b512] Fix jni-swig-stub cache
[eb7683b] More cache fixes
[ff58582] Attempt to fix caching
[ef51caa] JNI caching and windows cmdline
[278d06d] Use proper line split
[8d83809] bat fixes
[81c1249] Attempt to build windows jvm
[7bb5f81] Attempt to fix docker build
[2ddf50c] swig also depends on cache
[99cbc9f] Proper stub task
[bd05668] Fix path
[39d73f0] Fix path
[4e5bb0d] Syntax
[e703dca] Syntax
[eff7755] Preliminary support for JVM
[cd6c060] Make sure that simulator builds work for both x64 and arm64 independently.
[51fa175] Fix ios arm64 build
[d81da94] Attempt to test ios
[f43eb95] Disable arm builds completely
[40db240] Add more documentation
[66aa337] Don't publish arm simulator for sync
[675c883] Fix target
[cf4806b] Proper dependency for ios tests
[dad3caf] First attempt at iOS build
[217e592] More fixes
[1cd0dac] Disable macos arm tests because we lack the Android SDK on the runner for now
[e1b4ee4] Matrix macOs builds
[ef78e1f] Fix macos caching
[b62fdfd] Run macos tests on macos, not android tests
[7537d71] Add support for building only macOS arm64
[a0aeb8b] Add macos testing
[87d1513] Re-enable builds
[0b401c9] Working version of delete file
[9be0848] Rework caching logic to work around issues with paths and split builds
[43fdaf3] Play around with paths
[bd55aab] Attempt to download to other cache path
Copy link
Collaborator

@nhachicha nhachicha left a comment

Choose a reason for hiding this comment

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

Huge effort 🎉 left some minor comments. Also didn't went thoroughly against the KTS script (still in progress?)

.github/actions/setup-build-dependencies/action.yml Outdated Show resolved Hide resolved
.github/workflows/auto-merge-branches.yml Outdated Show resolved Hide resolved
.github/workflows/include-deploy-snapshot.yml Outdated Show resolved Hide resolved
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
working-directory: tools
run: kotlin ./publish_snapshots.main.kts "../" "${{ inputs.version-label }}" "$GPG_SIGNING_KEY" "$GPG_PASS_PHRASE" "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't this pass the secret in plain text as arguments? maybe publish_snapshots.main.kts can read directly the arguments as environment variable inside the script?

Copy link
Contributor Author

@cmelchior cmelchior Jan 16, 2024

Choose a reason for hiding this comment

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

No, GHA detects this and hides it in the log output:

Run kotlin ./publish_snapshots.main.kts "../" "1.13.0-gha-SNAPSHOT" "$GPG_SIGNING_KEY" "$GPG_PASS_PHRASE" "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD"
  kotlin ./publish_snapshots.main.kts "../" "1.13.0-gha-SNAPSHOT" "$GPG_SIGNING_KEY" "$GPG_PASS_PHRASE" "$MAVEN_CENTRAL_USER" "$MAVEN_CENTRAL_PASSWORD"
  shell: /usr/bin/bash -e {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/11.0.[2](https://github.com/realm/realm-kotlin/actions/runs/7035340087/job/19147261366#step:7:2)1-9/x6[4](https://github.com/realm/realm-kotlin/actions/runs/7035340087/job/19147261366#step:7:4)
    JAVA_HOME_11_X[6](https://github.com/realm/realm-kotlin/actions/runs/7035340087/job/19147261366#step:7:6)4: /opt/hostedtoolcache/Java_Zulu_jdk/11.0.21-9/x64
    GPG_SIGNING_KEY: ***
    GPG_PASS_PHRASE: ***
    MAVEN_CENTRAL_USER: ***
    MAVEN_CENTRAL_PASSWORD: ***
Setup signing key

.github/workflows/include-deploy-snapshot.yml Outdated Show resolved Hide resolved
.github/workflows/pr.yml Show resolved Hide resolved
os: [macos-latest, ubuntu-latest, windows-latest] # TODO Should we also test om MacOS arm64?
include:
- os: macos-latest
test-title: Unit Test Results - Base JVM MacOS x64
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was referring to these Junit file reports that should be displayed in the summary

GHA_README.md Outdated Show resolved Hide resolved
GHA_README.md Show resolved Hide resolved
tools/publish_snapshots.main.kts Outdated Show resolved Hide resolved
@cmelchior cmelchior merged commit 697e738 into main Jan 30, 2024
53 checks passed
@cmelchior cmelchior deleted the feature/github-actions branch January 30, 2024 21:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to Github Actions
4 participants