Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo dist #2528

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RUST_TEST_THREADS = "1"
xtask = "run --package xtask --"

[build]
# when changing these please also change .github/workflows/steps/release-build-setup.yml
rustflags = [
"-C", "force-unwind-tables", # Include full unwind tables when aborting on panic
"-C" , "debug-assertions", # Enable debug assertions in release builds to have more safeguards in place
Expand Down
212 changes: 0 additions & 212 deletions .github/workflows/binaries.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: CI
on:
pull_request:
workflow_call:
inputs:
# comes from cargo-dist workflow call
plan:
required: true
type: string
workflow_dispatch:
push:
branches:
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build release Docker images

on:
workflow_call:
inputs:
# comes from cargo-dist workflow call
plan:
required: true
type: string

env:
PLAN: ${{ inputs.plan }}

jobs:
build-docker-image:
name: Build server Docker image
uses: ./.github/workflows/docker.yml
secrets: inherit
with:
pushToDockerHub: true
parca: true

docker-cli:
name: Push CLI Docker image
runs-on: ubuntu-latest
env:
REPOSITORY_OWNER: ${{ github.repository_owner }}
GHCR_REGISTRY: "ghcr.io"
GHCR_REGISTRY_USERNAME: ${{ github.actor }}
GHCR_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: "restate-cli"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- 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: Log into DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Download linux binaries
uses: actions/download-artifact@v4
with:
pattern: artifacts-*-unknown-linux-musl
merge-multiple: true

- name: Write release version
id: version
run: |
VERSION="$(echo "$PLAN" | jq -r '[.releases[] | select(.app_name == "restate-cli")][0].app_version')"
echo Version: ${VERSION}
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}
${{ format('docker.io/{0}/{1}', env.REPOSITORY_OWNER, env.IMAGE_NAME) }}

tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.VERSION }}

- name: Create Dockerfile
run: |
cat > Dockerfile << 'EOF'
FROM --platform=${BUILDPLATFORM} alpine as builder
ADD restate-cli-aarch64-unknown-linux-musl.tar.xz /restate-arm64
ADD restate-cli-x86_64-unknown-linux-musl.tar.xz /restate-amd64
# keep output image small by removing the server binary
RUN rm /restate-*/restate-server

FROM alpine
ARG TARGETARCH
COPY --from=builder /restate-${TARGETARCH} /
ENTRYPOINT [ "/restate" ]
EOF

- name: Build and push multiplatform image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64,linux/amd64
23 changes: 12 additions & 11 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ name: Release helm chart
on:
workflow_call:
inputs:
ref:
description: 'ref to build eg v0.8.0'
required: false
type: string
version:
description: 'push helm chart with this version, eg v0.8.0'
# comes from cargo-dist workflow call
plan:
required: true
type: string
workflow_dispatch:
inputs:
ref:
description: 'ref to build eg v0.8.0'
description: "ref to build eg v0.8.0"
required: false
type: string
version:
description: 'push helm chart with this version, eg v0.8.0'
description: "push helm chart with this version, eg 0.8.0"
required: true
type: string

env:
PLAN: '${{ inputs.plan || ''{"releases": [{"app_name": "restate-server", "app_version": "${{ inputs.version }}"}]}'' }}'

jobs:
release-helm-chart:
runs-on: ubuntu-latest
Expand All @@ -31,9 +32,9 @@ jobs:
- name: Write release version
id: version
run: |
VERSION=${{ inputs.version }}
echo Version: ${VERSION#v}
echo "VERSION=${VERSION#v}" >> "$GITHUB_OUTPUT"
VERSION="$(echo "$PLAN" | jq -r '[.releases[] | select(.app_name == "restate-server")][0].app_version')"
echo Version: ${VERSION}
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Check helm versions
run: |
grep -qF 'version: "${{ steps.version.outputs.VERSION }}"' charts/restate-helm/Chart.yaml
Expand Down
Loading
Loading