This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
chore(offchain): bump debian image to bookworm-20230814 #565
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Build | |
on: | |
pull_request: | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
packages: write | |
id-token: write | |
contents: read | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
env: | |
CARGO_REGISTRIES_CARTESI_INDEX: https://github.com/cartesi/crates-index | |
RUSTFLAGS: -D warnings -C debuginfo=0 | |
defaults: | |
run: | |
working-directory: offchain | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: 📦 Install protoc | |
run: sudo apt update && sudo apt install -y protobuf-compiler libprotobuf-dev | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
offchain/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install cargo sweep | |
run: cargo install cargo-sweep | |
continue-on-error: true | |
- name: Install cargo cache | |
run: cargo install cargo-cache | |
continue-on-error: true | |
- name: Check format | |
run: cargo fmt --all -- --check | |
- name: Set sweep timestamp | |
run: cargo sweep -s | |
- name: Build binaries and tests | |
run: cargo build --all-targets | |
- name: Clean old build files | |
run: cargo sweep -f | |
- name: Clean dependencies source files | |
run: cargo cache --autoclean | |
- name: Run tests | |
run: cargo test | |
test_onchain: | |
runs-on: ubuntu-22.04 | |
needs: test | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly-d369d2486f85576eec4ca41d277391dfdae21ba7 | |
- name: Install dependencies | |
run: yarn | |
working-directory: onchain/rollups | |
- name: Build contracts | |
run: yarn build | |
working-directory: onchain/rollups | |
- name: Generate proofs | |
run: yarn proofs:setup | |
working-directory: onchain/rollups | |
- name: Run tests | |
run: yarn test | |
working-directory: onchain/rollups | |
build_docker: | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
- test_onchain | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=sha,format=long | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: depot/setup-action@v1 | |
- name: Build docker images | |
id: docker_build | |
uses: depot/bake-action@v1 | |
with: | |
files: | | |
./docker-bake.hcl | |
${{ steps.docker_meta.outputs.bake-file }} | |
./docker-bake.platforms.hcl | |
targets: deps | |
push: true | |
project: ${{ vars.DEPOT_PROJECT }} | |
- uses: snok/container-retention-policy@v1 | |
with: | |
image-names: rollups | |
cut-off: one second ago UTC | |
timestamp-to-use: updated_at | |
account-type: org | |
org-name: ${{ github.repository_owner }} | |
token: ${{ secrets.GHCR_TOKEN }} | |
dispatcher: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: dispatcher | |
image-name: rollups-dispatcher | |
secrets: inherit | |
state_server: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: state-server | |
image-name: rollups-state-server | |
secrets: inherit | |
graphql_server: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: graphql-server | |
image-name: rollups-graphql-server | |
secrets: inherit | |
indexer: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: indexer | |
image-name: rollups-indexer | |
secrets: inherit | |
inspect_server: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: inspect-server | |
image-name: rollups-inspect-server | |
secrets: inherit | |
advance_runner: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: advance-runner | |
image-name: rollups-advance-runner | |
secrets: inherit | |
host_runner: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: host-runner | |
image-name: rollups-host-runner | |
secrets: inherit | |
hardhat: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: hardhat | |
image-name: rollups-hardhat | |
secrets: inherit | |
cli: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: cli | |
image-name: rollups-cli | |
secrets: inherit | |
deployments: | |
needs: build_docker | |
uses: ./.github/workflows/docker.yml | |
with: | |
target: deployments | |
image-name: rollups-deployments | |
secrets: inherit |