Skip to content

Commit

Permalink
simplify ci workflow
Browse files Browse the repository at this point in the history
drop schedule
merge edge & pr jobs
upload artifacts rather than publish to ghcr
  • Loading branch information
CamJN committed Jul 18, 2024
1 parent 0f74704 commit 353bec3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 34 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/dockerimage-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Docker Image CI
on:
create:
workflow_dispatch:
schedule:
- cron: '15 05 * * 1' # Late night for the Americas, early morning for Europe
pull_request:
paths-ignore:
- '**.md'
Expand Down Expand Up @@ -35,34 +33,7 @@ jobs:

build_pr:
name: "Test Build Docker images"
if: github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
OWNER: '${{ github.repository_owner }}'
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
- name: Enable docker multiarch
uses: docker/setup-qemu-action@v3
- name: Fix docker logs
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
env.BUILDKIT_STEP_LOG_MAX_SIZE=-1
env.BUILDKIT_STEP_LOG_MAX_SPEED=-1
default-load=true
- name: Build the Docker images
run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC" build_{{matrix.arch}}

build_edge:
name: "Build edge Docker images"
if: github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule'
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || ( github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule' )
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -91,9 +62,14 @@ jobs:
env.BUILDKIT_STEP_LOG_MAX_SPEED=-1
default-load=true
- name: Build the Docker images
run: make "OWNER=$OWNER_LC" VERSION=edge build_{{matrix.arch}}
- name: Push the Docker images
run: make "OWNER=$OWNER_LC" VERSION=edge push_{{matrix.arch}}
run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC" build_{{matrix.arch}}
- name: Export image
run: make "OWNER=$OWNER_LC" export_{{matrix.arch}}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docker_image_{{matrix.arch}}
path: *.tar

build_release:
name: "Build release Docker images"
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ OWNER = phusion
DISABLE_OPTIMIZATIONS = 0
IMAGE = $(IMG_REPO)/$(OWNER)/holy-build-box

.PHONY: build_amd64 test_amd64 tags_amd64 push_amd64 build_arm64 test_arm64 tags_arm64 push_arm64 release
.PHONY: build_amd64 test_amd64 tags_amd64 push_amd64 build_arm64 test_arm64 tags_arm64 push_arm64 export_amd64 export_arm64 release

build_amd64:
docker buildx build --load --platform "linux/amd64" --rm -t $(IMAGE):$(VERSION)-amd64 --pull --build-arg DISABLE_OPTIMIZATIONS=$(DISABLE_OPTIMIZATIONS) .
Expand Down Expand Up @@ -51,6 +51,12 @@ ifdef MAJOR_VERSION
docker push $(IMAGE):latest-arm64
endif

export_amd64: tags_amd64
docker save -o hbb_amd64.tar $(IMAGE):$(VERSION)-amd64

export_arm64: tags_arm64
docker save -o hbb_arm64.tar $(IMAGE):$(VERSION)-arm64

release: push_amd64 push_arm64
docker manifest create $(IMAGE):$(VERSION) $(IMAGE):$(VERSION)-amd64 $(IMAGE):$(VERSION)-arm64
docker manifest push $(IMAGE):$(VERSION)
Expand Down

0 comments on commit 353bec3

Please sign in to comment.