Skip to content

Commit

Permalink
more CI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferret-san committed Nov 5, 2024
1 parent 972e8a5 commit 9d6c720
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 37 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/cannon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Install Node.js (often needed for contract tooling)
# Install Node.js with proper working directory for cache
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: packages/contracts-bedrock/package-lock.json

# Install dependencies in the correct directory
- name: Install npm dependencies
working-directory: packages/contracts-bedrock
run: npm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
- name: Install contract dependencies
working-directory: packages/contracts-bedrock
run: just install

Expand All @@ -53,7 +59,6 @@ jobs:
packages/contracts-bedrock/artifacts
packages/contracts-bedrock/forge-artifacts
packages/contracts-bedrock/cache
cannon-prestate:
needs: [contracts-build]
runs-on: ubuntu-latest
Expand Down
30 changes: 16 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,28 @@ jobs:

- name: Prepare Docker Tags
id: prep
shell: bash
run: |
# Get short SHA
SHA=$(git rev-parse --short HEAD)
SHA="$(git rev-parse --short HEAD)"
# Sanitize branch name by replacing invalid characters
BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -e 's/[^a-zA-Z0-9._-]/-/g')
# Sanitize branch name using parameter expansion
BRANCH="${GITHUB_REF#refs/heads/}"
BRANCH="${BRANCH//[^a-zA-Z0-9._-]/-}"
# For pull requests, use PR number
if [[ $GITHUB_REF == refs/pull/* ]]; then
PR_NUMBER=$(echo $GITHUB_REF | cut -d / -f 3)
TAGS="${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.component }}:pr-${PR_NUMBER}"
if [[ "${GITHUB_REF}" == refs/pull/* ]]; then
PR_NUMBER="$(echo "${GITHUB_REF}" | cut -d / -f 3)"
TAGS="${REGISTRY}/${REPO}/${{ matrix.component }}:pr-${PR_NUMBER}"
else
TAGS="${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.component }}:${SHA}"
TAGS="${REGISTRY}/${REPO}/${{ matrix.component }}:${SHA}"
# Add branch tag if not a PR
if [ "$BRANCH" != "" ]; then
TAGS="${TAGS},${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.component }}:${BRANCH}"
if [ -n "${BRANCH}" ]; then
TAGS="${TAGS},${REGISTRY}/${REPO}/${{ matrix.component }}:${BRANCH}"
fi
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v5
Expand All @@ -81,14 +83,14 @@ jobs:

- name: Save Docker image for testing
if: github.event_name == 'pull_request'
shell: bash
run: |
# Extract first tag from the list
FIRST_TAG=$(echo "${{ steps.prep.outputs.tags }}" | cut -d',' -f1)
docker save "${FIRST_TAG}" > /tmp/${{ matrix.component }}.tar
FIRST_TAG="$(echo "${{ steps.prep.outputs.tags }}" | cut -d',' -f1)"
docker save "${FIRST_TAG}" > "/tmp/${{ matrix.component }}.tar"
- name: Upload Docker image
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: docker-${{ matrix.component }}
path: /tmp/${{ matrix.component }}.tar
path: /tmp/${{ matrix.component celestia-
42 changes: 22 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Release

on:
# Manual trigger with required approval
workflow_dispatch:
# Automatic trigger on version tags
push:
tags:
- "da-server/v*"
Expand All @@ -18,7 +16,6 @@ env:
REPO: ${{ github.repository_owner }}

jobs:
# Wait for approval on manual release
approve-release:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
Expand All @@ -36,7 +33,6 @@ jobs:
strategy:
matrix:
component:
# Standard multi-platform components
- op-node
- op-batcher
- op-proposer
Expand All @@ -53,13 +49,14 @@ jobs:

- name: Extract version from tag
id: version
shell: bash
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/*/v}
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/*/v}"
else
VERSION="latest"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
Expand Down Expand Up @@ -98,14 +95,13 @@ jobs:
docker-release-amd64:
needs: [approve-release]
if: always() && (needs.approve-release.result == 'success' || needs.approve-release.result == 'skipped')
runs-on: ubuntu-latest-xlarge
runs-on: ubuntu-latest-16-cores # Changed from ubuntu-latest-xlarge
permissions:
contents: read
packages: write
strategy:
matrix:
component:
# AMD64-only components
- ci-builder
- ci-builder-rust
- proofs-tools
Expand All @@ -114,13 +110,14 @@ jobs:

- name: Extract version from tag
id: version
shell: bash
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/*/v}
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/*/v}"
else
VERSION="latest"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
Expand All @@ -132,6 +129,9 @@ jobs:
type=raw,value=${{ steps.version.outputs.version }}
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -147,7 +147,7 @@ jobs:
with:
context: .
push: true
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand All @@ -174,24 +174,26 @@ jobs:
]
steps:
- name: Verify Multi-platform Support
shell: bash
run: |
image_name="${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.component }}:sha-${{ github.sha }}"
image_name="${REGISTRY}/${REPO}/${component}:sha-${GITHUB_SHA}"
echo "Verifying image: $image_name"
echo "Verifying image: ${image_name}"
# Check for ARM64 support
echo "Checking ARM64 support..."
docker manifest inspect $image_name | jq -e '.manifests[] | select(.platform.architecture == "arm64")'
docker manifest inspect "${image_name}" | jq -e '.manifests[] | select(.platform.architecture == "arm64")'
# Check for AMD64 support
echo "Checking AMD64 support..."
docker manifest inspect $image_name | jq -e '.manifests[] | select(.platform.architecture == "amd64")'
docker manifest inspect "${image_name}" | jq -e '.manifests[] | select(.platform.architecture == "amd64")'
- name: Test Image
shell: bash
run: |
image_name="${{ env.REGISTRY }}/${{ env.REPO }}/${{ matrix.component }}:sha-${{ github.sha }}"
docker pull $image_name
docker run --rm $image_name ${{ matrix.component }} --version
image_name="${REGISTRY}/${REPO}/${component}:sha-${GITHUB_SHA}"
docker pull "${image_name}"
docker run --rm "${image_name}" "${component}" --version
notify-release:
needs: [verify-release]
Expand Down

0 comments on commit 9d6c720

Please sign in to comment.