rpc tests on demand #15150
Workflow file for this run
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
name: Forest Docker | |
# Cancel workflow if there is a new change to the branch. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "*" | |
merge_group: | |
pull_request: | |
# This needs to be declared explicitly so that the job is actually | |
# run when moved out of draft. | |
types: [opened, synchronize, reopened, ready_for_review] | |
env: | |
FOREST_TEST_IMAGE: forest-image | |
FOREST_TEST_ARCHIVE: forest-image.tar | |
jobs: | |
build-and-push-docker-image: | |
# Run the job only if the PR is not a draft. | |
# This is done to limit the runner cost. | |
if: github.event.pull_request.draft == false | |
name: Build images and push to GHCR | |
# Change to `buildjet-8vcpu-ubuntu-2204` if `fuzzy` is down. | |
# runs-on: fuzzy | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
timeout-minutes: 30 | |
steps: | |
- name: List cached docker images | |
run: docker image ls | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Github Packages | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub | |
continue-on-error: true | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build the fat image first, for details see <https://github.com/ChainSafe/forest/pull/3912> | |
# This step yields the following labels | |
# - {date}-{sha}-fat, e.g. 2023-01-19-da4692d-fat, | |
# - edge-fat | |
# - tag-fat (if pushed). | |
- name: Docker Meta fat | |
id: metafat | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/chainsafe/forest | |
flavor: | | |
latest=false | |
suffix=-fat | |
tags: | | |
type=raw,value={{date 'YYYY-MM-DD'}}-{{sha}} | |
type=ref,event=tag | |
type=edge | |
- name: Build fat image and push to GitHub Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: ${{ steps.metafat.outputs.tags }} | |
labels: ${{ steps.metafat.outputs.labels }} | |
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} | |
# Compile Docker image only for AMD64 for a regular PR to save some CI time. | |
platforms: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && 'linux/amd64,linux/arm64' || 'linux/amd64' }} | |
target: fat-image | |
# This step yields the following labels | |
# - date+sha, e.g. 2023-01-19-da4692d, | |
# - tag (if pushed). | |
- name: Docker Meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/chainsafe/forest | |
flavor: | | |
latest=false | |
tags: | | |
type=raw,value={{date 'YYYY-MM-DD'}}-{{sha}} | |
type=ref,event=tag | |
type=edge | |
- name: Build slim image and push to GitHub Container Registry | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} | |
# Compile Docker image only for AMD64 for a regular PR to save some CI time. | |
platforms: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && 'linux/amd64,linux/arm64' || 'linux/amd64' }} | |
target: slim-image |