Skip to content

Commit

Permalink
Merge pull request #28462 from ProvableHQ/fix/revert-ci-changes-to-pa…
Browse files Browse the repository at this point in the history
…tch-musl

[Fix] Improve Leo release CI
  • Loading branch information
d0cd authored Nov 22, 2024
2 parents bac534f + 1b46db1 commit d9fe41a
Showing 1 changed file with 97 additions and 55 deletions.
152 changes: 97 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Leo Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to build'
description: "The release tag (e.g., v1.0.0)."
required: true
release_flag:
description: "Set to true to upload the release, false to skip."
required: false
default: "false"

env:
RUST_BACKTRACE: 0
Expand All @@ -17,29 +19,36 @@ jobs:
name: Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout Specific Tag
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
submodules: recursive

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: Verify Cargo.lock Exists
run: |
if [ ! -f Cargo.lock ]; then
echo "Error: Cargo.lock file is missing. Aborting build."
exit 1
fi
- name: Build Leo
run: |
cargo build --package leo-lang --release --features noconfig && strip target/release/leo
cargo build --package leo-lang --release --locked --features noconfig && strip target/release/leo
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true

- id: get_version
uses: battila7/get-version-action@v2

- name: Zip
- name: Zip Artifact
run: |
mkdir tempdir
mv target/release/leo tempdir
Expand All @@ -50,8 +59,9 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event.inputs.release_flag == 'true' }}
with:
tag_name: ${{ github.event.inputs.tag }}
files: |
leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-gnu.zip
env:
Expand All @@ -61,11 +71,12 @@ jobs:
name: Linux musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Specific Tag
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
ref: ${{ inputs.tag }}
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
Expand All @@ -74,6 +85,13 @@ jobs:
components: rustfmt
target: x86_64-unknown-linux-musl

- name: Verify Cargo.lock Exists
run: |
if [ ! -f Cargo.lock ]; then
echo "Error: Cargo.lock file is missing. Aborting build."
exit 1
fi
- name: Build
run: |
docker pull clux/muslrust:stable
Expand All @@ -86,7 +104,7 @@ jobs:
rustup install stable &&
rustup default stable &&
rustup target add x86_64-unknown-linux-musl &&
cargo build --target x86_64-unknown-linux-musl --package leo-lang --release --features noconfig
cargo build --target x86_64-unknown-linux-musl --package leo-lang --release --locked --features noconfig
"
- name: Check Binary
Expand All @@ -95,7 +113,7 @@ jobs:
- id: get_version
uses: battila7/get-version-action@v2

- name: Zip
- name: Zip Artifact
run: |
mkdir tempdir
cp target/x86_64-unknown-linux-musl/release/leo tempdir
Expand All @@ -105,12 +123,11 @@ jobs:
cd ..
mv tempdir/leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-musl.zip .
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(inputs.tag, 'v')
if: ${{ github.event.inputs.release_flag == 'true' }}
with:
tag_name: ${{ inputs.tag }}
tag_name: ${{ github.event.inputs.tag }}
files: |
leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-musl.zip
env:
Expand All @@ -120,29 +137,36 @@ jobs:
name: macOS
runs-on: macos-13
steps:
- name: Checkout
- name: Checkout Specific Tag
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
submodules: recursive

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: Verify Cargo.lock Exists
run: |
if [ ! -f Cargo.lock ]; then
echo "Error: Cargo.lock file is missing. Aborting build."
exit 1
fi
- name: Build Leo
run: |
cargo build --package leo-lang --release && strip target/release/leo
cargo build --package leo-lang --release --locked && strip target/release/leo
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true

- id: get_version
uses: battila7/get-version-action@v2

- name: Zip
- name: Zip Artifact
run: |
mkdir tempdir
mv target/release/leo tempdir
Expand All @@ -153,8 +177,9 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event.inputs.release_flag == 'true' }}
with:
tag_name: ${{ github.event.inputs.tag }}
files: |
leo-${{ steps.get_version.outputs.version }}-x86_64-apple-darwin.zip
env:
Expand All @@ -169,32 +194,42 @@ jobs:
with:
xcode-version: latest-stable

- name: Checkout
- name: Checkout Specific Tag
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
submodules: recursive

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
target: aarch64-apple-darwin
toolchain: stable
override: true
components: rustfmt


- name: Verify Cargo.lock Exists
run: |
if [ ! -f Cargo.lock ]; then
echo "Error: Cargo.lock file is missing. Aborting build."
exit 1
fi
- name: Build Leo
run: |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) \
cargo build -p leo-lang --release --target=aarch64-apple-darwin --features noconfig && strip target/aarch64-apple-darwin/release/leo
SDKROOT=$(xcrun --sdk macosx --show-sdk-path) \
MACOSX_DEPLOYMENT_TARGET=$(xcrun --sdk macosx --show-sdk-platform-version) \
cargo build --package leo-lang --release --locked --target=aarch64-apple-darwin --features noconfig
strip target/aarch64-apple-darwin/release/leo
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true

- id: get_version
uses: battila7/get-version-action@v2

- name: Zip
- name: Zip Artifact
run: |
mkdir tempdir
mv target/aarch64-apple-darwin/release/leo tempdir
Expand All @@ -205,67 +240,74 @@ jobs:
mv tempdir/leo-${{ steps.get_version.outputs.version }}-aarch64-apple-darwin.zip .
mv tempdir/leo.zip .
- name: Release macos m1 version
- name: Release macOS M1 Version
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event.inputs.release_flag == 'true' }}
with:
tag_name: ${{ github.event.inputs.tag }}
files: |
leo-${{ steps.get_version.outputs.version }}-aarch64-apple-darwin.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release leo.zip
- name: Release Universal Version
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event.inputs.release_flag == 'true' }}
with:
tag_name: ${{ github.event.inputs.tag }}
files: |
leo.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows:
name: Windows
runs-on: windows-latest
steps:
- name: Checkout
- name: Checkout Specific Tag
uses: actions/checkout@v2
with:
submodules: true
ref: ${{ github.event.inputs.tag }}
fetch-depth: 0
submodules: recursive

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "11"
version: "11" # Specify the LLVM/Clang version you need
directory: ${{ runner.temp }}/llvm

- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
run: echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV

- name: Verify Cargo.lock Exists
run: |
if [ ! -f Cargo.lock ]; then
echo "Error: Cargo.lock file is missing. Aborting build."
exit 1
fi
- name: Build Leo
run: |
cargo build --package leo-lang --release --features noconfig
cargo build --package leo-lang --release --locked --features noconfig
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true

- id: get_version
uses: battila7/get-version-action@v2

- name: Zip
- name: Zip Artifact
run: |
Compress-Archive target/release/leo.exe leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-msvc.zip
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
if: ${{ github.event.inputs.release_flag == 'true' }}
with:
tag_name: ${{ github.event.inputs.tag }}
files: |
leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-msvc.zip
env:
Expand Down

0 comments on commit d9fe41a

Please sign in to comment.