From 0a74856017aa6a3386e98bc0746e14d9b2f62808 Mon Sep 17 00:00:00 2001 From: Francisco Moura Date: Thu, 29 Aug 2024 15:50:26 -0300 Subject: [PATCH] fix: fix the CI make-generate to use an image with the cartesi machine --- .github/workflows/build.yml | 118 +++++++++++++++++++++--------------- build/Dockerfile | 36 +++++++++++ 2 files changed, 106 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a92963a60..e9290c5d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,51 @@ permissions: contents: write jobs: + build-ci-base: + runs-on: ubuntu-22.04 + outputs: + output: ${{ steps.export_tag.outputs.image_tag }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v5 + with: + images: | + name=ghcr.io/cartesi/rollups-node-ci + tags: | + type=semver,pattern={{version}} + type=ref,event=branch + type=ref,event=pr + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + 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 + with: + files: | + ./docker-bake.hcl + ${{ steps.docker_meta.outputs.bake-file }} + ./docker-bake.platforms.hcl + targets: rollups-node-ci + push: true + project: ${{ vars.DEPOT_PROJECT }} + workdir: build + + - name: Export Image Tag + id : export_tag + run : echo "image_tag=${{steps.docker_meta.outputs.version}}" >> "$GITHUB_OUTPUT" + do-basic-checks: runs-on: ubuntu-22.04 steps: @@ -40,9 +85,6 @@ jobs: path: ./ config: .github/license-check/config.json - - name: Check auto generated files - run: make check-generate - - name: Lint Markdown docs uses: DavidAnson/markdownlint-cli2-action@v16 with: @@ -50,6 +92,31 @@ jobs: *.md docs/*.md + check-generated-files: + 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 + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - 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: + go-version-file: 'go.mod' + + - name: Check auto generated files + run: make check-generate + + test-rust: runs-on: ubuntu-22.04 env: @@ -126,51 +193,6 @@ jobs: - name: Run tests run: cargo test - build-ci-base: - runs-on: ubuntu-22.04 - outputs: - output: ${{ steps.export_tag.outputs.image_tag }} - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Docker meta - id: docker_meta - uses: docker/metadata-action@v5 - with: - images: | - name=ghcr.io/cartesi/rollups-node-ci - tags: | - type=semver,pattern={{version}} - type=ref,event=branch - type=ref,event=pr - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - 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 - with: - files: | - ./docker-bake.hcl - ${{ steps.docker_meta.outputs.bake-file }} - ./docker-bake.platforms.hcl - targets: rollups-node-ci - push: true - project: ${{ vars.DEPOT_PROJECT }} - workdir: build - - - name: Export Image Tag - id : export_tag - run : echo "image_tag=${{steps.docker_meta.outputs.version}}" >> "$GITHUB_OUTPUT" - test-go: runs-on: ubuntu-22.04 container: diff --git a/build/Dockerfile b/build/Dockerfile index 1187e8c3a..6afa92081 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -375,6 +375,42 @@ ARG GO_BUILD_PATH ARG ROLLUPS_NODE_VERSION WORKDIR ${GO_BUILD_PATH} +ARG MACHINE_EMULATOR_VERSION +ARG DEBIAN_FRONTEND=noninteractive + +# Install ca-certificates and curl (setup). +RUN <