Skip to content

feat(build): parallelize go-build-release and github actions with matrix#200

Merged
oschwartz10612 merged 3 commits intofosrl:mainfrom
water-sucks:parallelize-makefile
Dec 13, 2025
Merged

feat(build): parallelize go-build-release and github actions with matrix#200
oschwartz10612 merged 3 commits intofosrl:mainfrom
water-sucks:parallelize-makefile

Conversation

@water-sucks
Copy link
Copy Markdown
Contributor

@water-sucks water-sucks commented Dec 12, 2025

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

This PR splits the go-build-release Makefile rule into individual targets based on arch, and composes them such that they can be parallelized using make -j.

It also applies this parallelization to the pull request CI workflow using a build matrix with each Makefile rule being a separate entry in said matrix, which cuts CI times massively.

How to test?

go-build-release should work the same as before, and CI times should be cut by a non-trivial number.

@oschwartz10612
Copy link
Copy Markdown
Member

😍 looks amazing! Are you good to go on this or were you adding anything else. Just checking as its a draft.

@water-sucks
Copy link
Copy Markdown
Contributor Author

Left it in draft mode because I want to figure out why the docker-build-release rule is still failing CI.

@oschwartz10612
Copy link
Copy Markdown
Member

I think its because qemu and buildx might not be setup for multi platform builds like we do in the cicd pipeline. But for tests I dont think we need to build docker on each platform - maybe we just have a separate docker build test command to build on the native amd64 for the test?

@water-sucks
Copy link
Copy Markdown
Contributor Author

So, I came to the realization that using ubuntu-latest runners (which are free for FOSS) in a matrix for each Makefile rule is much faster than using -j in a single runner where there's only two cores I believe.

The bottleneck for build time now is the Docker image build, which now runs in a minute, so that's much better than the 4-7 minutes it was taking before.

@water-sucks water-sucks marked this pull request as ready for review December 12, 2025 23:05
@water-sucks water-sucks changed the title feat(build): parallelize go-build-release using make -j flag feat(build): parallelize go-build-release and github actions with matrix Dec 12, 2025
Copy link
Copy Markdown
Member

@oschwartz10612 oschwartz10612 left a comment

Choose a reason for hiding this comment

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

LGTM only think we should still build latest tag for docker.

Comment thread Makefile
echo "Error: tag is required. Usage: make docker-build-release tag=<tag>"; \
exit 1; \
fi
docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64 -t fosrl/newt:latest -f Dockerfile --push .
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we still want to tag latest when we run the docker build release but IDK if we are even still using this in the cicd but could be good to have for other use.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I was a bit confused by this at first. I thought it was just a redundant run of buildx using a different parameter.

Was it actually necessary to both run this using a tag of latest and to require the tag var as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To me those make sense to run as two separate rules in the matrix if that is the case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actuall I think we can just double tag in the same command like:

docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64 -t fosrl/newt:latest -t fosrl/newt/$(tag) -f Dockerfile --push .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah very cool, so the tag var should ideally still be required then for this rule?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah I think so

@oschwartz10612
Copy link
Copy Markdown
Member

LGTM! THANKS!

@oschwartz10612 oschwartz10612 merged commit d5e0771 into fosrl:main Dec 13, 2025
11 checks passed
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.

2 participants