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

add release pipeline: builds, verifies BITCOIN_DA_ID, releases binary #1000

Merged
merged 5 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
147 changes: 147 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: release

on:
push:
tags:
- "v*.*.*"

env:
EXPECTED_BITCOIN_DA_ID: ${{ vars.EXPECTED_BITCOIN_DA_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:

x86_64_binary_extraction:
runs-on: ubicloud-standard-30
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt update && sudo apt -y install curl gcc cpp cmake clang llvm
sudo apt -y autoremove && sudo apt clean && sudo rm -rf /var/lib/apt/lists/*

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install Cargo Binstall
run: |
source $HOME/.cargo/env
cargo install cargo-binstall

- name: Install Cargo Risczero
run: |
cargo binstall -y cargo-risczero
cargo risczero install --version v2024-04-22.0

- name: Build Project
env:
REPR_GUEST_BUILD: 1
run: |
cargo build --release

- name: Check BITCOIN_DA_ID
id: check-id
run: |
RESULT=$(grep -R "BITCOIN_DA_ID" target/ || echo "Grep failed")

if echo "$RESULT" | grep -q "${{ env.EXPECTED_BITCOIN_DA_ID }}"; then
echo "Check passed successfully."
else
echo "Check failed. Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} "
echo "Actual: $RESULT"
exit 1
fi

- name: Upload x86_64 Binary
uses: actions/upload-artifact@v4
with:
name: citrea_${{ github.ref_name }}_x86_64
path: target/release/citrea

osx_arm64_binary_extraction:
runs-on: self-hosted-citrea-osx-arm64
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

- name: Install Cargo Binstall
run: |
source $HOME/.cargo/env
cargo install cargo-binstall

- name: Install Cargo Risczero
run: |
source $HOME/.cargo/env
cargo binstall -y cargo-risczero
cargo risczero install --version v2024-04-22.0

- name: Build Project
env:
REPR_GUEST_BUILD: 1
run: |
source $HOME/.cargo/env
cargo build --release

- name: Check BITCOIN_DA_ID
id: check-id
run: |
RESULT=$(grep -R "BITCOIN_DA_ID" target/ || echo "Grep failed")

if echo "$RESULT" | grep -q "${{ env.EXPECTED_BITCOIN_DA_ID }}"; then
echo "Check passed successfully."
else
echo "Check failed. Expected: BITCOIN_DA_ID ${{ env.EXPECTED_BITCOIN_DA_ID }} "
echo "Actual: $RESULT"
exit 1
fi

- name: Upload osx_arm64 Binary
uses: actions/upload-artifact@v4
with:
name: citrea_${{ github.ref_name }}_osx_arm64
path: target/release/citrea

release:
needs: [ x86_64_binary_extraction, osx_arm64_binary_extraction ]
runs-on: ubuntu-latest
steps:
- name: Download x86_64 Binary
uses: actions/download-artifact@v4
with:
name: citrea_${{ github.ref_name }}_x86_64
path: release

- name: rename file
run: |
mv release/citrea release/citrea_${{ github.ref_name }}_x86_64

- name: Download OSX ARM64 Binary
uses: actions/download-artifact@v4
with:
name: citrea_${{ github.ref_name }}_osx_arm64
path: release

- name: rename file
run: |
mv release/citrea release/citrea_${{ github.ref_name }}_osx_arm64

- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
release/citrea_${{ github.ref_name }}_osx_arm64
release/citrea_${{ github.ref_name }}_x86_64
name: Release ${{ github.ref_name }}
body: |
This is the release for version ${{ github.ref_name }}.

It includes:
- citrea_${{ github.ref_name }}_x86_64
- citrea_${{ github.ref_name }}_osx_arm64
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:22.04

RUN apt update && apt -y install curl gcc cpp cmake clang llvm && apt -y autoremove && apt clean && rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN /root/.cargo/bin/cargo install cargo-binstall
RUN /root/.cargo/bin/cargo binstall -y cargo-risczero
RUN /root/.cargo/bin/cargo risczero install --version v2024-04-22.0

WORKDIR /citrea
COPY . .

RUN /root/.cargo/bin/cargo build --release
cetin marked this conversation as resolved.
Show resolved Hide resolved
Loading