-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use rules_workflows for CircleCI config generation
- Loading branch information
1 parent
e71ed0b
commit 3b6024d
Showing
3 changed files
with
22 additions
and
95 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,14 @@ | ||
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file") | ||
load("@aspect_rules_workflows//workflows:defs.bzl", "circleci_aspect_workflows_config", "circleci_merged_config") | ||
|
||
CIRCLECI_ORG = "aspect-build" | ||
|
||
CIRCLECI_USER_CONFIG_FILE = "//.circleci:user-config.yml" | ||
|
||
alias( | ||
name = "rosetta", | ||
actual = select({ | ||
"@bazel_tools//src/conditions:darwin_arm64": "@rosetta_darwin_aarch64//file:rosetta", | ||
"@bazel_tools//src/conditions:darwin_x86_64": "@rosetta_darwin_x86_64//file:rosetta", | ||
"@bazel_tools//src/conditions:linux_aarch64": "@rosetta_linux_aarch64//file:rosetta", | ||
"@bazel_tools//src/conditions:linux_x86_64": "@rosetta_linux_x86_64//file:rosetta", | ||
}), | ||
) | ||
|
||
alias( | ||
name = "circleci-config-merge", | ||
actual = select({ | ||
"@bazel_tools//src/conditions:darwin_arm64": "@circleci_config_merge_darwin_aarch64//:circleci-config-merge", | ||
"@bazel_tools//src/conditions:darwin_x86_64": "@circleci_config_merge_darwin_x86_64//:circleci-config-merge", | ||
"@bazel_tools//src/conditions:linux_aarch64": "@circleci_config_merge_linux_aarch64//:circleci-config-merge", | ||
"@bazel_tools//src/conditions:linux_x86_64": "@circleci_config_merge_linux_x86_64//:circleci-config-merge", | ||
}), | ||
circleci_aspect_workflows_config( | ||
name = "aspect-workflows-config", | ||
circleci_org = "aspect-build", | ||
) | ||
|
||
genrule( | ||
name = "aspect_workflows_config", | ||
srcs = ["//.aspect/workflows:config.yaml"], | ||
outs = [":aspect-workflows-config.yml"], | ||
cmd = "CIRCLE_PROJECT_USERNAME={0} $(execpath :rosetta) steps --configuration .aspect/workflows/config.yaml --host circleci > $@".format(CIRCLECI_ORG), | ||
tools = [":rosetta"], | ||
) | ||
|
||
genrule( | ||
name = "merge_config", | ||
srcs = [ | ||
":aspect-workflows-config.yml", | ||
CIRCLECI_USER_CONFIG_FILE, | ||
circleci_merged_config( | ||
name = "config", | ||
circleci_config_files = [ | ||
":user-config.yml", | ||
":aspect-workflows-config", | ||
], | ||
outs = [":_config.yml"], | ||
cmd = "echo -e '# GENERATED FILE - DO NOT EDIT!\\n# Update with: bazel run //.circleci:write_merged_config' > $@ && $(execpath :circleci-config-merge) merge $(execpath :aspect-workflows-config.yml) $(execpath {0}) >> $@".format(CIRCLECI_USER_CONFIG_FILE), | ||
tools = [":circleci-config-merge"], | ||
) | ||
|
||
write_source_file( | ||
name = "write_merged_config", | ||
in_file = ":_config.yml", | ||
out_file = "config.yml", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters