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

Cache bounty example builds #140

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ jobs:
id: setup_buildx
uses: docker/setup-buildx-action@v3

- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3

- name: Build bounty examples
run: make bounties
env:
BUILDX_BUILDER: ${{ steps.setup_buildx.outputs.name }}

- name: Extract metadata from Git refs and GitHub events
id: extract_metadata
Expand Down
12 changes: 11 additions & 1 deletion tests/bounties/busybox-bounty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ BOUNTY_RISCV64_TAR=busybox-$(VERSION)-bounty_riscv64.tar.xz
HARDEN_CFLAGS=-Os -D_FORTIFY_SOURCE=2 -fPIE -fstack-clash-protection -fstack-protector-strong -ffunction-sections -fdata-sections -Wno-unused-result
HARDEN_LDFLAGS=-pie -Wl,-z,now,-z,relro,--gc-sections -s

# Use GitHub Actions cache when available
ifdef ACTIONS_RUNTIME_TOKEN
ifdef ACTIONS_RUNTIME_URL
ifdef BUILDX_BUILDER
Comment on lines +12 to +14
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a better way to phrase this, @edubart? :-)

SCOPE=busybox-$(VERSION)-bounty
DOCKEROPTIONS=--cache-from type=gha,scope=$(SCOPE) --cache-to type=gha,mode=max,scope=$(SCOPE) --builder $(BUILDX_BUILDER) --load
endif
endif
endif

all: $(BOUNTY_TAR)

riscv64: $(BOUNTY_RISCV64_TAR)
Expand All @@ -33,7 +43,7 @@ $(SOURCE_TAR):

ifneq ($(ARCH), riscv64)
$(BOUNTY_RISCV64_TAR): Dockerfile start.sh
docker build --tag busybox-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) .
docker build --tag busybox-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) $(DOCKEROPTIONS) .
docker create --platform=linux/riscv64 --name busybox-bounty-cp busybox-bounty-cp
docker cp busybox-bounty-cp:/root/$@ $@
docker rm busybox-bounty-cp
Expand Down
12 changes: 11 additions & 1 deletion tests/bounties/lua-bounty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ BOUNTY_RISCV64_TAR=lua-$(VERSION)-bounty_riscv64.tar.xz
HARDEN_CFLAGS=-Os -D_FORTIFY_SOURCE=2 -fexceptions -fPIE -fstack-clash-protection -fstack-protector-strong -ffunction-sections -fdata-sections
HARDEN_LDFLAGS=-pie -Wl,-z,now,-z,relro,--gc-sections -s

# Use GitHub Actions cache when available
ifdef ACTIONS_RUNTIME_TOKEN
ifdef ACTIONS_RUNTIME_URL
ifdef BUILDX_BUILDER
SCOPE=lua-$(VERSION)-bounty
DOCKEROPTIONS=--cache-from type=gha,scope=$(SCOPE) --cache-to type=gha,mode=max,scope=$(SCOPE) --builder $(BUILDX_BUILDER) --load
endif
endif
endif

all: $(BOUNTY_TAR)

riscv64: $(BOUNTY_RISCV64_TAR)
Expand All @@ -31,7 +41,7 @@ $(SOURCE_TAR):

ifneq ($(ARCH), riscv64)
$(BOUNTY_RISCV64_TAR): Dockerfile start.sh bounty.lua
docker build --tag lua-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) .
docker build --tag lua-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) $(DOCKEROPTIONS) .
docker create --platform=linux/riscv64 --name lua-bounty-cp lua-bounty-cp
docker cp lua-bounty-cp:/root/$@ $@
docker rm lua-bounty-cp
Expand Down
12 changes: 11 additions & 1 deletion tests/bounties/solidity-bounty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ ARCH=$(shell uname -m)
VERSION=0.8.26
BOUNTY_RISCV64_TAR=solidity-$(VERSION)-bounty_riscv64.tar.xz

# Use GitHub Actions cache when available
ifdef ACTIONS_RUNTIME_TOKEN
ifdef ACTIONS_RUNTIME_URL
ifdef BUILDX_BUILDER
SCOPE=solidity-$(VERSION)-bounty
DOCKEROPTIONS=--cache-from type=gha,scope=$(SCOPE) --cache-to type=gha,mode=max,scope=$(SCOPE) --builder $(BUILDX_BUILDER) --load
endif
endif
endif

riscv64: $(BOUNTY_RISCV64_TAR)

$(BOUNTY_RISCV64_TAR): Dockerfile start.sh
docker build --tag solidity-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) .
docker build --tag solidity-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) $(DOCKEROPTIONS) .
docker create --name solidity-bounty-cp solidity-bounty-cp
docker cp solidity-bounty-cp:/root/$@ $@
docker rm solidity-bounty-cp
Expand Down
12 changes: 11 additions & 1 deletion tests/bounties/sqlite-bounty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ HARDEN_LDFLAGS=-pie -Wl,-z,now,-z,relro,--gc-sections
SQLITE_CFLAGS=-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
SQLITE_LDFLAGS=-lm -s

# Use GitHub Actions cache when available
ifdef ACTIONS_RUNTIME_TOKEN
ifdef ACTIONS_RUNTIME_URL
ifdef BUILDX_BUILDER
SCOPE=sqlite-$(VERSION)-bounty
DOCKEROPTIONS=--cache-from type=gha,scope=$(SCOPE) --cache-to type=gha,mode=max,scope=$(SCOPE) --builder $(BUILDX_BUILDER) --load
endif
endif
endif

all: $(BOUNTY_TAR)

riscv64: $(BOUNTY_RISCV64_TAR)
Expand All @@ -37,7 +47,7 @@ $(SOURCE_TAR):

ifneq ($(ARCH), riscv64)
$(BOUNTY_RISCV64_TAR): Dockerfile start.sh
docker build --tag sqlite-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) .
docker build --tag sqlite-bounty-cp --file Dockerfile --progress plain --build-arg VERSION=$(VERSION) $(DOCKEROPTIONS) .
docker create --platform=linux/riscv64 --name sqlite-bounty-cp sqlite-bounty-cp
docker cp sqlite-bounty-cp:/root/$@ $@
docker rm sqlite-bounty-cp
Expand Down