-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v15] WIP: ci: Build buildox-ng on GitHub push events
Rebuild buildbox-ng and/or buildbox-thirdparty on changes to the files that define those buildboxes when pushes on master or a release branch are done.
- Loading branch information
Showing
3 changed files
with
130 additions
and
58 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Build buildbox images | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- branch/** | ||
- camh/** | ||
|
||
jobs: | ||
build: | ||
name: Build buildboxes | ||
runs-on: ubuntu-22.04-32core | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check changes | ||
id: changes | ||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
with: | ||
base: ${{ github.ref }} | ||
filters: | | ||
buildbox: | ||
- 'build.assets/versions.mk' | ||
- 'build.assets/images.mk' | ||
- 'build.assets/buildbox/Dockerfile' | ||
- 'build.assets/buildbox/clang-12.sh' | ||
thirdparty: | ||
- 'build.assets/images.mk' | ||
- 'build.assets/buildbox/Dockerfile-thirdparty' | ||
- 'build.assets/buildbox/build-buildbox.mk' | ||
- 'build.assets/buildbox/buildbox-common.mk' | ||
- 'build.assets/buildbox/cross-compile.mk' | ||
- 'build.assets/buildbox/crosstoolng-configs/**' | ||
- 'build.assets/buildbox/crosstoolng.mk' | ||
- 'build.assets/buildbox/pkgconfg/**' | ||
- 'build.assets/buildbox/thirdparty-libs.mk' | ||
- name: Set up Docker Buildx | ||
if: steps.changes.outputs.thirdparty || steps.changes.outputs.buildbox | ||
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | ||
with: | ||
driver: docker | ||
|
||
- name: Login to registry | ||
if: steps.changes.outputs.thirdparty || steps.changes.outputs.buildbox | ||
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build buildbox-thirdparty | ||
if: steps.changes.outputs.thirdparty | ||
run: | ||
make -C build.assets buildbox-thirdparty PUSH=1 | ||
|
||
- name: Build buildbox-ng | ||
if: steps.changes.outputs.thirdparty || steps.changes.outputs.buildbox | ||
run: | ||
make -C build.assets buildbox-ng PUSH=1 |
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
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# This makefile fragment is included in build.assets/Makefile. | ||
# It depends on these already being included: | ||
# * build.assets/version.mk (for GOLANG_VERSION AND RUST_VERSION) | ||
# * build.assets/images.mk (for BUILDBOX_NG and BUILDBOX_THIRDPARTY) | ||
|
||
|
||
# | ||
# Build the buildbox-ng using the pre-built third party components from the | ||
# buildbox-thirdparty image | ||
# | ||
.PHONY: buildbox-ng | ||
buildbox-ng: | ||
docker buildx build \ | ||
--build-arg THIRDPARTY_IMAGE=$(BUILDBOX_THIRDPARTY) \ | ||
--build-arg GOLANG_VERSION=$(GOLANG_VERSION) \ | ||
--build-arg RUST_VERSION=$(RUST_VERSION) \ | ||
--cache-from $(BUILDBOX_NG) \ | ||
--cache-to type=inline \ | ||
$(if $(PUSH),--push,--load) \ | ||
--tag $(BUILDBOX_NG) \ | ||
-f buildbox/Dockerfile \ | ||
buildbox | ||
|
||
# | ||
# Build the buildbox thirdparty components. This rarely needs to be rebuilt and is | ||
# slow to build, so it is done separately from the main buildbox | ||
# | ||
.PHONY: buildbox-thirdparty | ||
buildbox-thirdparty: | ||
docker buildx build \ | ||
--cache-from $(BUILDBOX_THIRDPARTY) \ | ||
--cache-to type=inline \ | ||
$(if $(PUSH),--push,--load) \ | ||
--tag $(BUILDBOX_THIRDPARTY) \ | ||
-f buildbox/Dockerfile-thirdparty \ | ||
buildbox | ||
|
||
# | ||
# A generic build rule to build a stage of Dockerfile-thirdparty based | ||
# on the $(STAGE) variable. These stage builds are used for development | ||
# of the thirdparty buildbox, whether to configure crosstool-NG | ||
# (see config/buildbox-ng), or when adding additional third party | ||
# libraries using either the compilers stage or libs stage. | ||
# | ||
.PHONY: buildbox-thirdparty-stage | ||
buildbox-thirdparty-stage: | ||
docker buildx build \ | ||
--load \ | ||
--tag buildbox-thirdparty-$(STAGE):$(BUILDBOX_VERSION) \ | ||
-f buildbox/Dockerfile-thirdparty \ | ||
--target $(STAGE) \ | ||
buildbox | ||
|
||
.PHONY: buildbox-thirdparty-crosstoolng | ||
buildbox-thirdparty-crosstoolng: STAGE=crosstoolng | ||
buildbox-thirdparty-crosstoolng: buildbox-thirdparty-stage | ||
|
||
.PHONY: buildbox-thirdparty-compilers | ||
buildbox-thirdparty-compilers: STAGE=compilers | ||
buildbox-thirdparty-compilers: buildbox-thirdparty-stage | ||
|
||
.PHONY: buildbox-thirdparty-libs | ||
buildbox-thirdparty-libs: STAGE=libs | ||
buildbox-thirdparty-libs: buildbox-thirdparty-stage | ||
|