Skip to content

Commit ca0d7d7

Browse files
authored
ci: build docker image on PRs / tags (#2353)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview This PR adds a workflow which will build the rollkit image on each PR, in a follow up we can use this image to perform upgrade tests. If it's on a PR, it will be tagged like `pr-1234`, if it's a tag or main it will be tagged with the format `v1.0.0` or `main`. <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated continuous integration workflows to support dynamic Docker image tagging for test jobs. - Added automated building and publishing of Docker images during testing. - Introduced a placeholder for future upgrade tests. - Removed the separate Docker build and publish workflow to streamline processes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 60403ae commit ca0d7d7

3 files changed

Lines changed: 37 additions & 20 deletions

File tree

.github/workflows/ci_release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
test:
3030
uses: ./.github/workflows/test.yml
3131
secrets: inherit
32+
with:
33+
# tag with the pr in the format of pr-1234 or the tag / branch if it is not a PR.
34+
image-tag: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}
3235

3336
proto:
3437
uses: ./.github/workflows/proto.yml

.github/workflows/docker-build-publish.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,42 @@
33
name: Tests / Code Coverage
44
on:
55
workflow_call:
6+
inputs:
7+
image-tag:
8+
required: true
9+
type: string
610

711
jobs:
12+
build-docker-image:
13+
name: Build Docker Image
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Log in to GHCR
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Build and push Docker image with PR tag
30+
uses: docker/build-push-action@v5
31+
with:
32+
context: .
33+
push: true
34+
tags: ghcr.io/${{ github.repository_owner }}/rollkit:${{ inputs.image-tag }}
35+
36+
upgrade-tests:
37+
needs: build-docker-image
38+
runs-on: ubuntu-latest
39+
steps:
40+
- run: exit 0 # TODO: add upgrade test uses the image built in the build-docker-image step
41+
842
build_all-apps:
943
name: Build All Rollkit Binaries
1044
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)