Skip to content

Commit

Permalink
feat(CI): update to new-build
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolitzer committed Feb 3, 2025
1 parent c748b20 commit 2187f90
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 57 deletions.
3 changes: 2 additions & 1 deletion .github/license-check/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"include": ["**/*.go", "**/*.rs"],
"exclude": [
"cmd/authority-claimer/target/**",
"internal/repository/postgres/db/**",
"pkg/contracts/**",
"pkg/readerclient/generated.go",
"pkg/inspectclient/generated.go",
"pkg/readerclient/generated.go",
"rollups-contracts/**"
],
"license": ".github/license-check/header.txt"
Expand Down
87 changes: 43 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
output: ${{ steps.export_tag.outputs.image_tag }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Docker meta
id: docker_meta
Expand All @@ -46,19 +44,35 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: depot/setup-action@v1
- name: Build and push docker image
id: docker_build
uses: depot/bake-action@v1
- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Build test image
uses: depot/build-push-action@v1
with:
files: |
./docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file }}
./docker-bake.platforms.hcl
targets: rollups-node-ci
file: Dockerfile
context: .
target: go-builder
platforms: linux/amd64,linux/arm64
tags: ghcr.io/cartesi/rollups-node-ci:${{steps.docker_meta.outputs.version}}
push: true
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
project: ${{ vars.DEPOT_PROJECT }}
workdir: build
token: ${{ secrets.DEPOT_TOKEN }}

- name: Build devnet image
uses: depot/build-push-action@v1
with:
file: test/devnet/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
tags: ghcr.io/cartesi/rollups-node-devnet:${{steps.docker_meta.outputs.version}}
push: true
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}

- name: Export Image Tag
id : export_tag
Expand Down Expand Up @@ -107,7 +121,7 @@ jobs:

- name: Fix VCS Issue
run : git config --global --add safe.directory /__w/rollups-node/rollups-node

- name: Install Go
uses: actions/setup-go@v5
with:
Expand All @@ -118,47 +132,32 @@ jobs:

test-go:
runs-on: ubuntu-22.04
container:
image: ghcr.io/cartesi/rollups-node-ci:${{needs.build-ci-base.outputs.output}}
needs:
- build-ci-base
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: depot/setup-action@v1
- name: Build dependency images
uses: depot/bake-action@v1
with:
files: |
./docker-bake.hcl
./docker-bake.override.hcl
./docker-bake.platforms.hcl
targets: |
rollups-node-devnet
rollups-node-snapshot
project: ${{ vars.DEPOT_PROJECT }}
workdir: build
load: true

- name: Install Go
uses: actions/setup-go@v5
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
go-version-file: 'go.mod'

- name: Fix VCS Go Linter Issue
run : git config --global --add safe.directory /__w/rollups-node/rollups-node
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run Go Linter
uses: golangci/golangci-lint-action@v6
- uses: hoverkraft-tech/[email protected]
env:
TAG: ${{needs.build-ci-base.outputs.output}}
REGISTRY: ghcr.io/
with:
version: v1.58.2
workdir: build
compose-file: "compose.individual-services.yaml"
services: |
ethereum_provider
database
migration
- name: Run Go tests
env:
TESTCONTAINERS_RYUK_DISABLED: true
run: go test ./...
run: docker run --rm -it ghcr.io/cartesi/rollups-node-ci:${{needs.build-ci-base.outputs.output}} make -C rollups-node unit-test-go GO_TEST_PACKAGES=./internal/advancer/

build-docker:
runs-on: ubuntu-22.04
Expand Down
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

# syntax=docker.io/docker/dockerfile:1

ARG EMULATOR_VERSION=0.18.1
ARG MACHINE_EMULATOR_VERSION=0.18.1

# Build directories.
ARG GO_BUILD_PATH=/build/cartesi/go

FROM cartesi/machine-emulator:${EMULATOR_VERSION} AS common-env
FROM cartesi/machine-emulator:${MACHINE_EMULATOR_VERSION} AS common-env

USER root

Expand Down Expand Up @@ -84,8 +84,7 @@ ARG GO_BUILD_PATH

# Build application.
COPY --chown=cartesi:cartesi . ${GO_BUILD_PATH}/rollups-node/

RUN cd ${GO_BUILD_PATH}/rollups-node && make build-go
RUN make -C ${GO_BUILD_PATH}/rollups-node build-go

# =============================================================================
# STAGE: rollups-node
Expand All @@ -97,7 +96,7 @@ RUN cd ${GO_BUILD_PATH}/rollups-node && make build-go
# (This stage copies the binaries from previous stages.)
# =============================================================================

FROM cartesi/machine-emulator:${EMULATOR_VERSION} AS rollups-node
FROM cartesi/machine-emulator:${MACHINE_EMULATOR_VERSION} AS rollups-node

ARG NODE_RUNTIME_DIR=/var/lib/cartesi-rollups-node

Expand Down
14 changes: 7 additions & 7 deletions compose.individual-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ x-env: &env

services:
ethereum_provider:
image: cartesi/rollups-node-devnet:devel
image: ${REGISTRY}cartesi/rollups-node-devnet:${TAG}
networks:
- devnet
ports:
Expand All @@ -33,8 +33,8 @@ services:
POSTGRES_DB: rollupsdb

migration:
image: cartesi/rollups-node:devel
command: cartesi-rollups-cli db upgrade -p postgres://postgres:password@database:5432/rollupsdb?sslmode=disable
image: ${REGISTRY}cartesi/rollups-node-ci:${TAG}
command: ./rollups-node/cartesi-rollups-cli db upgrade -p postgres://postgres:password@database:5432/rollupsdb?sslmode=disable
depends_on:
database:
condition: service_healthy
Expand All @@ -45,7 +45,7 @@ services:
<<: *env

evmreader:
image: cartesi/rollups-node:devel
image: ${REGISTRY}cartesi/rollups-node:${TAG}
command: cartesi-rollups-evm-reader
depends_on:
database:
Expand All @@ -60,7 +60,7 @@ services:
<<: *env

advancer:
image: cartesi/rollups-node:devel
image: ${REGISTRY}cartesi/rollups-node:${TAG}
command: cartesi-rollups-advancer
depends_on:
database:
Expand All @@ -77,7 +77,7 @@ services:
<<: *env

validator:
image: cartesi/rollups-node:devel
image: ${REGISTRY}cartesi/rollups-node:${TAG}
command: cartesi-rollups-validator
depends_on:
database:
Expand All @@ -90,7 +90,7 @@ services:
<<: *env

claimer:
image: cartesi/rollups-node:devel
image: ${REGISTRY}cartesi/rollups-node:${TAG}
command: cartesi-rollups-claimer
depends_on:
database:
Expand Down
3 changes: 3 additions & 0 deletions internal/advancer/machines/machines_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)

package machines

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/service/address.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)

// Implementation of the pflags Value interface.
package service

Expand Down
3 changes: 3 additions & 0 deletions pkg/service/log.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)

// Implementation of the pflags Value interface.
package service

Expand Down

0 comments on commit 2187f90

Please sign in to comment.