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

Sargon CI/CD on ubuntu #218

Merged
merged 35 commits into from
Sep 25, 2024
Merged

Sargon CI/CD on ubuntu #218

merged 35 commits into from
Sep 25, 2024

Conversation

micbakos-rdx
Copy link
Contributor

@micbakos-rdx micbakos-rdx commented Sep 23, 2024

The purpose of this PR is to run all possible jobs that do not include swift in an ubuntu machine.

Changes made:

  • README is updated to include instructions for building in both MacOs and Linux. Also removed the instruction to install ktlint as it extremely slows down the build.
  • Rust toolchain is changed to nightly-2024-07-30 in rust-toolchain.toml and in all github workflow files. The reason behind it is because when building on linux, a dependency we use iota-crypto has a transitive dependency to ed25519-dalek which uses a feature not being available in the current nightly toolchain. Although the newer toolchain produces some warnings with tarpaulin. We might need to resolve them in a later PR.
  • Regarding the gradle related files:
    • sargon-desktop module is no loner needed. When the release-desktop.yml workflow is invoked it automatically packages only the related sargon binaries and publishes them into a jar. Having a second module was making it extremely difficult to run unit tests on on ubuntu.
    • sargon-android gradle script is now aware of the underlying arch and decides what binaries to build according to it. When developing sargon and need to run unit tests, the script will detect if it is running on a MacOs or Linux machine and build the related binaries only, while skipping the ndk binaries. This saves a lot of time in both local development and github tests.
    • When publishing for android, only ndk binaries are built
    • When publishing for desktop, we let the github runner assemble the binaries with a matrix targeting both mac os and linux and then copying the binaries into the resources folder and publishing the jar.

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.0%. Comparing base (6148c79) to head (7349c5f).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##            main    #218    +/-   ##
======================================
  Coverage   97.0%   97.0%            
======================================
  Files        938     934     -4     
  Lines      15011   14810   -201     
  Branches      66      66            
======================================
- Hits       14562   14374   -188     
+ Misses       442     429    -13     
  Partials       7       7            
Flag Coverage Δ
kotlin 98.8% <ø> (ø)
rust 96.4% <ø> (+<0.1%) ⬆️
swift 99.4% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 91 files with indirect coverage changes

@micbakos-rdx micbakos-rdx marked this pull request as ready for review September 25, 2024 10:58
// Currently our CI supports building on Mac OS and we don't care about Mac Intel for now.
// So we skip the rest.
val supported = listOf(DarwinAArch64)
val ciSupported = listOf(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we ever need to build for other os, for example windows, we can add more to that and also make sure release-desktop.yml includes an entry to that host in the matrix.

tasks.getByName("clean") {
dependsOn(cleanTask)
}
fun Project.currentTargetTriple(): DesktopTargetTriple {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Helper function to let gradle detect the underlying target triple by running rustc --version --verbose and reading from host:

Exec::class
) {
val regenerate = properties["regenerate"] ?: true //TODO improve by using gradle outputs
afterEvaluate {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This block sums up the order of tasks that need to run on each occasion. Tasks that involve unit tests don't need to build cargo with ndk, but need to generate bindings. On the other hand tasks that involve building for android or building the integration tests that should run on an android device need to compile ndk binaries and exclude the desktop ones.

Copy link
Contributor

@CyonAlexRDX CyonAlexRDX left a comment

Choose a reason for hiding this comment

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

nice, lgtm!

@micbakos-rdx micbakos-rdx merged commit b6c2379 into main Sep 25, 2024
11 checks passed
@micbakos-rdx micbakos-rdx deleted the ci/ubuntu-runners branch September 25, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants