Skip to content

[WIP] Why the docker build for CI takes so long? #5036

[WIP] Why the docker build for CI takes so long?

[WIP] Why the docker build for CI takes so long? #5036

Workflow file for this run

name: CI
on:
pull_request:
workflow_call:
workflow_dispatch:
push:
branches:
- main
jobs:
build-and-test:
name: Build and test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: read
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
#os: [ubuntu-22.04, macos-latest] # 1 macos-latest minute counts as 10 minutes --> quite expensive :-(
os: [ubuntu-22.04]
env:
RUST_BACKTRACE: full
steps:
- name: Clean up Github actions runner
uses: jlumbroso/[email protected]
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Install liburing
run: sudo apt-get install -y liburing-dev
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
rustflags: ""
- name: Install protoc
uses: ./.github/actions/install-protoc
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Setup just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check Cargo.lock file is updated
run: cargo update -w --locked
- name: Run verify
run: just verify
docker:
name: Create docker debug image
runs-on: ubuntu-latest
timeout-minutes: 40
env:
REPOSITORY_OWNER: ${{ github.repository_owner }}
GHCR_REGISTRY: 'ghcr.io'
GHCR_REGISTRY_USERNAME: ${{ github.actor }}
GHCR_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clean up Github actions runner
uses: jlumbroso/[email protected]
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU dependency
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: Build
- name: Setup caching
uses: actions/cache@v4
id: cache
with:
path: |
cargo-home
target
key: restate-server-${{ hashFiles('**/Cargo.lock') }}
- name: Log into GitHub container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ env.GHCR_REGISTRY_USERNAME }}
password: ${{ env.GHCR_REGISTRY_TOKEN }}
- name: Inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"cargo-home": "/usr/src/app/cargo-home",
"target": "/usr/src/app/target"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Build Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: 'docker/Dockerfile-debug'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false
load: true
platforms: 'linux/amd64'
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
- name: Save docker image as tar
run: |
docker save -o restate.tar ${{ steps.build.outputs.imageid }}
- name: Upload docker image tar as artifact
uses: actions/upload-artifact@v4
with:
name: restate.tar
path: restate.tar
retention-days: 1
if-no-files-found: error
sdk-java:
name: Run SDK-Java integration tests
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/sdk-java/.github/workflows/integration.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
sdk-java-neo-invocation-status:
name: Run SDK-Java integration tests with NeoInvocationStatus
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/sdk-java/.github/workflows/integration.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
envVars: |
RESTATE_WORKER__EXPERIMENTAL_FEATURE_NEW_INVOCATION_STATUS_TABLE=true
testArtifactOutput: sdk-java-neo-invocation-status-integration-test-report
sdk-python:
name: Run SDK-Python integration tests
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/sdk-python/.github/workflows/integration.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
sdk-go:
name: Run SDK-Go integration tests
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/sdk-go/.github/workflows/integration.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
sdk-typescript:
name: Run SDK-Typescript integration tests
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/sdk-typescript/.github/workflows/integration.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
sdk-rust:
name: Run SDK-Rust integration tests
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/sdk-rust/.github/workflows/integration.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
e2e:
name: Run e2e tests
permissions:
contents: read
issues: read
checks: write
pull-requests: write
actions: read
secrets: inherit
needs: docker
uses: restatedev/e2e/.github/workflows/e2e.yaml@main
with:
restateCommit: ${{ github.event.pull_request.head.sha || github.sha }}
e2eRef: main