Skip to content

Commit c24fc33

Browse files
committed
chore: macos m1 runner support
1 parent d209736 commit c24fc33

File tree

5 files changed

+111
-39
lines changed

5 files changed

+111
-39
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ jobs:
4646
fail-fast: true
4747
max-parallel: 3
4848
matrix:
49-
os: [ ubuntu-latest, macos-latest ]
49+
os: [ ubuntu-latest, macos-latest, macos-14 ]
5050
jdk: [ ea ]
5151
include:
5252
- os: macos-latest
53-
native_task: :macosArm64Test :macosX64Test
53+
native_task: :macosX64Test
54+
- os: macos-14
55+
native_task: :macosArm64Test
5456
- os: ubuntu-latest
5557
native_task: :linuxX64Test
5658

gradle/build-logic/src/main/kotlin/common/GithubAction.kt

Lines changed: 83 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ object GithubAction {
1919
/** Return workflow run's URL */
2020
val workflowRunURL
2121
get() =
22-
when (isEnabled) {
23-
true ->
22+
when {
23+
isEnabled ->
2424
"${Env.GITHUB_SERVER_URL}/${Env.GITHUB_REPOSITORY}/actions/runs/${Env.GITHUB_RUN_ID}"
2525
else -> null
2626
}
@@ -331,7 +331,7 @@ object GithubAction {
331331

332332
/**
333333
* The name of the action currently running, or the id of a step. For example, for an action,
334-
* __repo-owner_name-of-action-repo. GitHub removes special characters, and uses the name __run
334+
* __repo-owner_name-of-action-repo.GitHub removes special characters, and uses the name __run
335335
* when the current step runs a script without an id. If you use the same script or action more
336336
* than once in the same job, the name will include a suffix that consists of the sequence
337337
* number preceded by an underscore. For example, the first script you run will have the name
@@ -343,8 +343,9 @@ object GithubAction {
343343

344344
/**
345345
* The path where an action is located. This property is only supported in composite actions.
346-
* You can use this path to access files located in the same repository as the action. For
347-
* example, /home/runner/work/_actions/repo-owner/name-of-action-repo/v1.
346+
* You can use this path to change directories to where the action is located and access other
347+
* files in that same repository. For example,
348+
* /home/runner/work/_actions/repo-owner/name-of-action-repo/v1.
348349
*/
349350
val GITHUB_ACTION_PATH
350351
get() = getenv("GITHUB_ACTION_PATH")
@@ -367,6 +368,13 @@ object GithubAction {
367368
val GITHUB_ACTOR
368369
get() = getenv("GITHUB_ACTOR")
369370

371+
/**
372+
* The account ID of the person or app that triggered the initial workflow run. For
373+
* example, 1234567. Note that this is different from the actor username.
374+
*/
375+
val GITHUB_ACTOR_ID
376+
get() = getenv("GITHUB_ACTOR_ID")
377+
370378
/** Returns the API URL. For example: https://api.github.com. */
371379
val GITHUB_API_URL
372380
get() = getenv("GITHUB_API_URL")
@@ -380,8 +388,8 @@ object GithubAction {
380388
get() = getenv("GITHUB_BASE_REF")
381389

382390
/**
383-
* The path on the runner to the file that sets environment variables from workflow commands.
384-
* This file is unique to the current step and changes for each step in a job. For example,
391+
* The path on the runner to the file that sets variables from workflow commands. This file is
392+
* unique to the current step and changes for each step in a job. For example,
385393
* /home/runner/work/_temp/_runner_file_commands/set_env_87406d6e-4979-4d42-98e1-3dab1f48b13a.
386394
* For more information, see "Workflow commands for GitHub Actions."
387395
*/
@@ -415,6 +423,16 @@ object GithubAction {
415423
val GITHUB_JOB
416424
get() = getenv("GITHUB_JOB")
417425

426+
/**
427+
* The path on the runner to the file that sets the current step's outputs from workflow
428+
* commands. This file is unique to the current step and changes for each step in a job. For
429+
* example,
430+
* /home/runner/work/_temp/_runner_file_commands/set_output_a50ef383-b063-46d9-9157-57953fc9f3f0.
431+
* For more information, see "Workflow commands for GitHub Actions."
432+
*/
433+
val GITHUB_OUTPUT
434+
get() = getenv("GITHUB_OUTPUT")
435+
418436
/**
419437
* The path on the runner to the file that sets system PATH variables from workflow commands.
420438
* This file is unique to the current step and changes for each step in a job. For example,
@@ -439,12 +457,16 @@ object GithubAction {
439457

440458
/**
441459
* The short ref name of the branch or tag that triggered the workflow run. This value matches
442-
* the branch or tag name shown on GitHub. For example, feature-branch-1.
460+
* the branch or tag name shown on GitHub. For example, feature-branch-1. For pull requests, the
461+
* format is refs/pull/<pr_number>/merge.
443462
*/
444463
val GITHUB_REF_NAME
445464
get() = getenv("GITHUB_REF_NAME")
446465

447-
/** true if branch protections are configured for the ref that triggered the workflow run. */
466+
/**
467+
* true if branch protections or rulesets are configured for the ref that triggered the workflow
468+
* run.
469+
*/
448470
val GITHUB_REF_PROTECTED
449471
get() = getenv("GITHUB_REF_PROTECTED")
450472

@@ -456,10 +478,24 @@ object GithubAction {
456478
val GITHUB_REPOSITORY
457479
get() = getenv("GITHUB_REPOSITORY")
458480

481+
/**
482+
* The ID of the repository. For example, 123456789. Note that this is different from the
483+
* repository name.
484+
*/
485+
val GITHUB_REPOSITORY_ID
486+
get() = getenv("GITHUB_REPOSITORY_ID")
487+
459488
/** The repository owner's name. For example, octocat. */
460489
val GITHUB_REPOSITORY_OWNER
461490
get() = getenv("GITHUB_REPOSITORY_OWNER")
462491

492+
/**
493+
* The repository owner's account ID. For example, 1234567. Note that this is different from the
494+
* owner's name.
495+
*/
496+
val GITHUB_REPOSITORY_OWNER_ID
497+
get() = getenv("GITHUB_REPOSITORY_OWNER_ID")
498+
463499
/** The number of days that workflow run logs and artifacts are kept. For example, 90. */
464500
val GITHUB_RETENTION_DAYS
465501
get() = getenv("GITHUB_RETENTION_DAYS")
@@ -502,19 +538,39 @@ object GithubAction {
502538
/**
503539
* The path on the runner to the file that contains job summaries from workflow commands. This
504540
* file is unique to the current step and changes for each step in a job. For example,
505-
* /home/rob/runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c.
541+
* /home/runner/_layout/_work/_temp/_runner_file_commands/step_summary_1cb22d7f-5663-41a8-9ffc-13472605c76c.
506542
* For more information, see "Workflow commands for GitHub Actions."
507543
*/
508544
val GITHUB_STEP_SUMMARY
509545
get() = getenv("GITHUB_STEP_SUMMARY")
510546

547+
/**
548+
* The username of the user that initiated the workflow run. If the workflow run is a re-run,
549+
* this value may differ from github.actor. Any workflow re-runs will use the privileges of
550+
* github.actor, even if the actor initiating the re-run (github.triggering_actor) has different
551+
* privileges.
552+
*/
553+
val GITHUB_TRIGGERING_ACTOR
554+
get() = getenv("GITHUB_TRIGGERING_ACTOR")
555+
511556
/**
512557
* The name of the workflow. For example, My test workflow. If the workflow file doesn't specify
513558
* a name, the value of this variable is the full path of the workflow file in the repository.
514559
*/
515560
val GITHUB_WORKFLOW
516561
get() = getenv("GITHUB_WORKFLOW")
517562

563+
/**
564+
* The ref path to the workflow. For example,
565+
* octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch.
566+
*/
567+
val GITHUB_WORKFLOW_REF
568+
get() = getenv("GITHUB_WORKFLOW_REF")
569+
570+
/** The commit SHA for the workflow file. */
571+
val GITHUB_WORKFLOW_SHA
572+
get() = getenv("GITHUB_WORKFLOW_SHA")
573+
518574
/**
519575
* The default working directory on the runner for steps, and the default location of your
520576
* repository when using the checkout action. For example,
@@ -537,7 +593,11 @@ object GithubAction {
537593
val RUNNER_DEBUG
538594
get() = getenv("RUNNER_DEBUG") == "1"
539595

540-
/** The name of the runner executing the job. For example, Hosted Agent */
596+
/**
597+
* The name of the runner executing the job. This name may not be unique in a workflow run as
598+
* runners at the repository and organization levels could use the same name. For example,
599+
* Hosted Agent
600+
*/
541601
val RUNNER_NAME
542602
get() = getenv("RUNNER_NAME")
543603

@@ -558,7 +618,7 @@ object GithubAction {
558618

559619
/**
560620
* The path to the directory containing preinstalled tools for GitHub-hosted runners. For more
561-
* information, see "About GitHub-hosted runners". For example, C:\hostedtoolcache\windows
621+
* information, see "Using GitHub-hosted runners". For example, C:\hostedtoolcache\windows
562622
*/
563623
val RUNNER_TOOL_CACHE
564624
get() = getenv("RUNNER_TOOL_CACHE")
@@ -578,17 +638,17 @@ object GithubAction {
578638
val RUNNER_CONTEXT
579639
get() = getenv("RUNNER_CONTEXT")
580640

581-
/** OpenJDK 8 Home */
582-
val JAVA_HOME_8_X64
583-
get() = getenv("JAVA_HOME_8_X64")
584-
585-
/** OpenJDK 11 Home */
586-
val JAVA_HOME_11_X64
587-
get() = getenv("JAVA_HOME_11_X64")
588-
589-
/** OpenJDK 17 Home */
590-
val JAVA_HOME_17_X64
591-
get() = getenv("JAVA_HOME_17_X64")
641+
fun javaHomeFor(version: Int = 21) =
642+
when (version) {
643+
8,
644+
11,
645+
17,
646+
21 -> {
647+
val arch = if (RUNNER_ARCH == "ARM64") RUNNER_ARCH.lowercase() else RUNNER_ARCH
648+
getenv("JAVA_HOME_${version}_${arch}")
649+
}
650+
else -> throw IllegalArgumentException("Unsupported Java version: $version")
651+
}
592652

593653
/** Gets the value of the environment variable set in the Github action runner. */
594654
operator fun get(name: String): String? = getenv(name)

gradle/build-logic/src/main/kotlin/common/ProjectExtns.kt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ val Project.isSnapshot
7070
val Project.runsOnCI
7171
get() = providers.environmentVariable("CI").getOrElse("false").toBoolean()
7272

73+
val Project.composeReportsEnabled
74+
get() = hasProperty("composeCompilerReports")
75+
7376
/** Java version properties. */
7477
val Project.javaVersion
7578
get() = libs.versions.java.asProvider().map { JavaVersion.toVersion(it) }
@@ -334,14 +337,21 @@ fun KotlinCommonCompilerOptions.configureKotlinCommon() {
334337
suppressWarnings = false
335338
verbose = true
336339
freeCompilerArgs.addAll(
337-
"-Xcontext-receivers",
338-
"-Xexpect-actual-classes",
339-
"-Xallow-result-return-type",
340-
// "-P",
341-
// "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=${kotlinVersion.get()}",
342-
// "-P",
343-
// "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=...dir...",
344-
)
340+
buildList {
341+
add("-Xcontext-receivers")
342+
add("-Xexpect-actual-classes")
343+
add("-Xallow-result-return-type")
344+
if (composeReportsEnabled) {
345+
val reportPath = layout.buildDirectory.dir("compose_compiler").get().asFile.absolutePath
346+
add("-P")
347+
add(
348+
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=${kotlinVersion.get()}")
349+
add("-P")
350+
add("plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$reportPath")
351+
add("-P")
352+
add("plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$reportPath")
353+
}
354+
})
345355
}
346356

347357
context(Project)

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ kotlin-jvmtarget = "21"
66
kotlin-dsl-jvmtarget = "21"
77
kotlin-api-version = "1.9"
88
kotlin-lang-version = "2.0"
9-
gradle = "8.6-rc-3"
9+
gradle = "8.6-rc-4"
1010
node-version = "21.6.0"
1111
java-vendor = "Oracle"
1212
java-jvmArguments = "--enable-preview"
@@ -33,7 +33,7 @@ kotlinx-html = "0.11.0"
3333
kotlinx-benchmark = "0.4.10"
3434
kotlinx-metadata = "0.9.0"
3535
kotlinx-reflect-lite = "1.1.0"
36-
kotlinx-bincompat = "0.13.2"
36+
kotlinx-bincompat = "0.14.0"
3737
kotlin-wrappers = "1.0.0-pre.691"
3838
kotlin-redacted = "1.7.1"
3939
kotlinx-multik = "0.2.2"
@@ -44,10 +44,10 @@ ktor-cohort = "2.3.1"
4444
ksp-auto-service = "1.1.0"
4545
gradle-kotlin-dsl = "4.3.0"
4646
zip-prefixer = "0.3.1"
47-
ajalt-mordant = "2.2.0"
47+
ajalt-mordant = "2.3.0"
4848
ajalt-clikt = "4.1.0"
4949
ajalt-colormath = "3.4.0"
50-
compose-routing = "0.2.12"
50+
compose-routing = "0.2.13"
5151
classgraph = "4.8.161"
5252
cache4k = "0.11.0"
5353
dokka = "1.9.10"
@@ -92,7 +92,7 @@ java-keyring = "1.0.3"
9292
java-keychain = "1.1.0"
9393
webjars-xterm = "5.1.0"
9494
arrow-suspendapp = "0.4.1-alpha.5"
95-
exposed = "0.46.0"
95+
exposed = "0.47.0"
9696
postgresql = "42.7.1"
9797
hikariCP = "5.1.0"
9898
h2 = "2.2.220"

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-rc-3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-rc-4-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)