Add Github CI #14
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: CI | |
env: | |
FOUNDRY_PROFILE: ci | |
DOCKER_BUILDKIT: 1 | |
REGISTRY: ghcr.io | |
REPO: ${{ github.repository_owner }} | |
on: | |
push: | |
branches: | |
- celestia-develop | |
- test/github-actions | |
pull_request: | |
branches: | |
- celestia-develop | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
docker_name: | |
- op-node | |
- op-batcher | |
- op-program | |
- op-proposer | |
- op-challenger | |
- proofs-tools | |
- op-dispute-mon | |
- op-conductor | |
- da-server | |
- op-supervisor | |
- cannon | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set build environment | |
run: | | |
echo "REGISTRY=${{ env.REGISTRY }}" >> $GITHUB_ENV | |
echo "REPOSITORY=${{ env.REPO }}" >> $GITHUB_ENV | |
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
echo "GIT_DATE=$(git show -s --format='%ct')" >> $GITHUB_ENV | |
echo "GIT_VERSION=untagged" >> $GITHUB_ENV | |
echo "IMAGE_TAGS=${{ github.sha }},${{ github.ref_name }}" >> $GITHUB_ENV | |
echo "PLATFORMS=linux/amd64" >> $GITHUB_ENV | |
- name: Build Docker image | |
run: | | |
# Create buildx builder | |
docker buildx create --driver=docker-container --name=buildx-build --bootstrap --use | |
# Build using docker-bake.hcl | |
docker buildx bake \ | |
--progress plain \ | |
--builder=buildx-build \ | |
-f docker-bake.hcl \ | |
${{ matrix.docker_name }} | |
- name: Save Docker image for testing | |
if: github.event_name == 'pull_request' | |
run: | | |
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.docker_name }}:${{ github.sha }}" | |
docker save "$IMAGE_NAME" > "/tmp/${{ matrix.docker_name }}.tar" | |
- name: Upload Docker image | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-${{ matrix.docker_name }} | |
path: /tmp/${{ matrix.docker_name }}.tar |