diff --git a/.github/workflows/docker-build-publish.yml b/.github/workflows/docker-build-publish.yml new file mode 100644 index 000000000..1efe80d77 --- /dev/null +++ b/.github/workflows/docker-build-publish.yml @@ -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 }}" \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index afcc71df5..2677482ec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 @@ -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: @@ -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 @@ -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 @@ -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 @@ -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 @@ -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: