Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar-a16z committed Jan 24, 2025
1 parent 81380f2 commit c903756
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 31 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Push Docker Image

on:
push:
paths:
- '.github/workflows/Dockerfile'
branches: [main]
pull_request:
paths:
- '.github/workflows/Dockerfile'
branches: ['**', main]

jobs:
build-docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
outputs:
docker_digest: ${{ steps.build.outputs.digest }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker Image
id: build
uses: docker/build-push-action@v4
with:
push: true
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/jolt-icicle-image:latest
cache-to: type=inline
tags: |
ghcr.io/${{ github.repository_owner }}/jolt-icicle-image:latest
outputs: type=digest

- name: Log Docker Digest
run:
echo "Image Digest: ${{ steps.build.outputs.digest }}"
45 changes: 14 additions & 31 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [main]
pull_request:
branches: ['**', main]
workflow_run:
workflows:
- Build and Push Docker Image
types:
- completed

env:
RUSTFLAGS: -D warnings
Expand All @@ -15,21 +20,6 @@ concurrency:
cancel-in-progress: true

jobs:
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
outputs:
docker_image: ${{ steps.build.outputs.docker_image }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Build Docker Image
id: build
run: |
docker build -t custom-cuda-image:latest -f .github/workflows/Dockerfile .
echo "docker_image=custom-cuda-image:latest" >> $GITHUB_ENV
fmt:
runs-on: ubuntu-latest
steps:
Expand All @@ -43,23 +33,10 @@ jobs:
command: fmt
args: --all --check

fmt-icicle:
name: Format Check with icicle
runs-on: ubuntu-latest
needs: [build-docker]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run cargo fmt with icicle
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
custom-cuda-image:latest \
cargo fmt --all --check --features icicle
clippy:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/jolt-icicle-image:latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
Expand All @@ -70,6 +47,8 @@ jobs:
with:
command: clippy
args: --all
- name: cargo clippy icicle
run: cargo clippy --all --features icicle

machete:
runs-on: ubuntu-latest
Expand All @@ -92,6 +71,8 @@ jobs:

test:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/jolt-icicle-image:latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
Expand All @@ -106,6 +87,8 @@ jobs:
uses: taiki-e/install-action@nextest
- name: Run jolt-core tests
run: cargo nextest run --release -p jolt-core
- name: Run jolt-icicle tests
run: cargo nextest run --release -p jolt-core --features icicle

test-icicle:
name: Run icicle tests
Expand All @@ -119,7 +102,7 @@ jobs:
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
custom-cuda-image:latest \
jolt-icicle-image:latest \
cargo nextest run --release -p jolt-core --features icicle
on-chain:
Expand Down

0 comments on commit c903756

Please sign in to comment.