From b88930087e3ff631d6d9eb81a44f59a64067e736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= Date: Fri, 23 Aug 2024 14:47:16 +0300 Subject: [PATCH] add release pipeline: builds, verifies BITCOIN_DA_ID, releases binary (#1000) * add release pipeline: builds, verifies BITCOIN_DA_ID, releases citrea binary * add Dockerfile * env EXPECTED_DATA to EXPECTED_BITCOIN_DA_ID * add osx_arm64 release * remove dockerfile --- .github/workflows/release.yml | 147 ++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..6ea492222 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 \ No newline at end of file