Skip to content

Commit

Permalink
CI: Release darwin binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Apr 24, 2024
1 parent e9ebff7 commit 3882e22
Showing 1 changed file with 35 additions and 21 deletions.
56 changes: 35 additions & 21 deletions .github/workflows/release-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ jobs:
timeout-minutes: 120
run: |
while true; do
# When supporting other architectures than Linux, this query should be adapted:
conclusion=$(gh api "repos/$GITHUB_REPOSITORY/commits/${{ env.TARGET_TAG }}/check-runs" --jq '.check_runs[] | select(.name | test("ci/hydra-build:.*-linux.required")) | .conclusion')
conclusion=$(gh api "repos/$GITHUB_REPOSITORY/commits/${{ env.TARGET_TAG }}/check-runs" --jq '.check_runs[] | select(.name | test("ci/hydra-build:.*\\.required")) | .conclusion' | more | uniq)
case "$conclusion" in
success)
echo "ci/hydra-build:required succeeded"
Expand All @@ -106,7 +105,7 @@ jobs:
echo "ci/hydra-build:required failed"
exit 1;;
*)
echo "ci/hydra-build:required pending. Waiting 30s..."
echo "ci/hydra-build:required pending with $conclusion. Waiting 30s..."
sleep 30;;
esac
done
Expand All @@ -115,10 +114,10 @@ jobs:
needs: [wait_for_hydra]
strategy:
matrix:
arch: [linux]
arch: [linux, x86_64-darwin, aarch64-darwin]
# TODO generalize
# arch: [linux, macos, win64]
name: "Download Asset from the Cache"
name: "Download Asset"
runs-on: ubuntu-latest
steps:
- name: Install Nix with good defaults
Expand All @@ -137,20 +136,27 @@ jobs:
run: |
case ${{ matrix.arch }} in
linux)
nix build --builders "" --max-jobs 0 ${{ env.LOCKED_URL }}#cardano-cli:exe:cardano-cli
tree result
cp result/bin/cardano-cli cardano-cli-${{ matrix.arch }} # (1)
derivation="cardano-cli:exe:cardano-cli"
;;
x86_64-darwin)
derivation="hydraJobs.x86_64-darwin.packages.cardano-cli:exe:cardano-cli"
;;
aarch64-darwin)
derivation="hydraJobs.aarch64-darwin.packages.cardano-cli:exe:cardano-cli"
;;
# TODO generalize
# macos)
# nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#cardano-cli:exe:cardano-cli
# tree result
# ;;
# win64)
# nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#x86_64-w64-mingw32:cardano-cli:exe:cardano-cli
# tree result
# derivation="x86_64-w64-mingw32:cardano-cli:exe:cardano-cli"
# ;;
*)
echo "Unrecognized arch: ${{ matrix.arch }}"
exit 1
;;
esac
nix build --builders "" --max-jobs 0 ${{ env.LOCKED_URL }}#$derivation
tree result
cp result/bin/cardano-cli cardano-cli-${{ matrix.arch }} # (1)
- uses: actions/upload-artifact@v4
with:
name: cardano-cli-${{ matrix.arch }} # (2)
Expand All @@ -166,22 +172,29 @@ jobs:
- uses: actions/checkout@v4 # We need the repo to execute extract-changelog.sh below
- uses: actions/download-artifact@v4
with:
name: cardano-cli-linux # Should match (2)
merge-multiple: true
# with:
# name: cardano-cli-linux # Should match (2)
# - uses: actions/download-artifact@v4
# with:
# name: cardano-cli-x86_64-darwin # Should match (2)
# - uses: actions/download-artifact@v4
# with:
# name: cardano-cli-aarch64-darwin # Should match (2)
# TODO generalize
# - uses: actions/download-artifact@v3
# with:
# name: cardano-cli-macos # Should match (2)
# - uses: actions/download-artifact@v3
# - uses: actions/download-artifact@v4
# with:
# name: cardano-cli-win64 # Should match (2)
- name: Compress
run: |
# (3)
# TARGET_TAG is of the form cardano-cli-8.22.0, so we don't need to prefix the tar.gz's name
# with cardano-cli
tar -czf ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-linux.tar.gz cardano-cli-linux
for arch in linux x86_64-darwin aarch64-darwin
do
tar -czf ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-$arch.tar.gz cardano-cli-$arch
done
# TODO generalize
# tar -czf ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-macos.tar.gz cardano-cli-macos
# zip ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-win64.zip cardano-cli-win64
- name: Create short tag
run: |
Expand All @@ -201,9 +214,10 @@ jobs:
tag_name: ${{ needs.wait_for_hydra.outputs.TARGET_TAG }} # Git tag the release is attached to
name: ${{ env.SHORT_TAG }} # Release name in GitHub UI
# TODO generalize
# cardano-cli-${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-macos.tar.gz
# cardano-cli-${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-win64.zip
# All entries in 'files' below should match (3)
files: |
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-linux.tar.gz
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-x86_64-darwin.tar.gz
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-aarch64-darwin.tar.gz
body_path: RELEASE_CHANGELOG.md

0 comments on commit 3882e22

Please sign in to comment.