Skip to content

Commit

Permalink
Merge branch 'calimero-network:master' into cli-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinjaypatel authored Dec 4, 2024
2 parents 8b6c6b2 + 1d5e22c commit 8d23ced
Show file tree
Hide file tree
Showing 42 changed files with 5,005 additions and 165 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ jobs:
- name: Build
run: cargo build --verbose

# Install pocket-ic for ICP Contract tests
- name: Install PocketIC server
uses: dfinity/pocketic@main
with:
pocket-ic-server-version: "7.0.0"

- name: Run tests
run: |
chmod +x $GITHUB_WORKSPACE/scripts/build-all-apps.sh
Expand Down
45 changes: 33 additions & 12 deletions .github/workflows/rust_binaries_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,45 @@ on:
push:
branches:
- master
- 'releases/**'
- 'hotfix/**'
paths:
- Cargo.toml
- Cargo.lock
- 'crates/**'
- .github/workflows/rust_binaries_release.yml
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
paths:
- Cargo.toml
- Cargo.lock
- 'crates/**'
- .github/workflows/rust_binaries_release.yml

jobs:
binary_matrix:
prepare:
runs-on: ubuntu-latest
outputs:
binaries: ${{ steps.setup_matrix.outputs.binaries }}
is_release_candidate: ${{ steps.check_release_candidate.outputs.is_release_candidate }}
binary_matrix: ${{ steps.setup_matrix.outputs.binary_matrix }}
steps:
- name: Check if release candidate
id: check_release_candidate
run: |
# Additional checks for head_ref when PR because GH doesn't support that
if [ "${{ github.event_name }}" == "pull_request" ] && ! [[ "${{ github.head_ref }}" == prerelease/* ]]; then
echo 'is_release_candidate=false' >> "$GITHUB_OUTPUT"
else
echo 'is_release_candidate=true' >> "$GITHUB_OUTPUT"
fi
- name: Setup matrix
id: setup_matrix
run: |
echo 'binaries=["merod", "meroctl"]' >> "$GITHUB_OUTPUT"
echo 'binary_matrix=["merod", "meroctl"]' >> "$GITHUB_OUTPUT"
build:
if: needs.prepare.outputs.is_release_candidate == 'true'
strategy:
matrix:
include:
Expand All @@ -35,7 +55,7 @@ jobs:
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
needs: binary_matrix
needs: prepare

steps:
- name: Checkout code
Expand All @@ -44,7 +64,7 @@ jobs:
- name: Craft cargo arguments
id: cargo_args
run: |
binaries=$(echo '${{ needs.binary_matrix.outputs.binaries }}' | jq -r 'join(" ") | split(" ") | map("-p " + .) | join(" ")')
binaries=$(echo '${{ needs.prepare.outputs.binary_matrix }}' | jq -r 'join(" ") | split(" ") | map("-p " + .) | join(" ")')
args="$binaries --release --target ${{ matrix.target }}"
echo "Cargo build arguments: $args"
echo args="$args" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -134,7 +154,7 @@ jobs:
- name: Compress artifacts using gzip
run: |
mkdir -p artifacts
echo '${{ needs.binary_matrix.outputs.binaries }}' | jq -r '.[]' | while read binary; do
echo '${{ needs.prepare.outputs.binary_matrix }}' | jq -r '.[]' | while read binary; do
tar -czf artifacts/"$binary"_${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release "$binary"
done
Expand All @@ -146,11 +166,12 @@ jobs:
retention-days: 2

release:
if: needs.prepare.outputs.is_release_candidate == 'true'
runs-on: ubuntu-latest
needs: [binary_matrix, build]
needs: [prepare, build]
strategy:
matrix:
binary: ${{ fromJSON(needs.binary_matrix.outputs.binaries) }}
binary: ${{ fromJSON(needs.prepare.outputs.binary_matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -165,7 +186,7 @@ jobs:
id: version_info
shell: bash
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "target_commit=${{ github.sha }}" >> $GITHUB_OUTPUT
Expand All @@ -174,7 +195,7 @@ jobs:
version="${{ matrix.binary }}-$version"
echo "Master version: $version"
if gh release view "$version" ${{ github.repository }} >/dev/null 2>&1; then
if gh release view "$version" --repo ${{ github.repository }} >/dev/null 2>&1; then
echo "Master release for this version already exists"
echo "release_required=false" >> $GITHUB_OUTPUT
else
Expand Down
Loading

0 comments on commit 8d23ced

Please sign in to comment.