From a26b2b9e217dfb7d9f2475b457a89186fd1eca2e Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Thu, 4 Jul 2024 08:28:54 +0000 Subject: [PATCH 1/4] add aarch64-linux (static) cross --- cabal.project | 11 +++++++++++ flake.nix | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cabal.project b/cabal.project index f4bc98a779..12ae24805f 100644 --- a/cabal.project +++ b/cabal.project @@ -36,6 +36,17 @@ if os(windows) constraints: time ^>=1.14 allow-newer: *:time +constraints: any.text source +-- Depending on C++ for just so slightly faster utf8 parsing is a bit annoying +-- especially as it brings in all kinds of complications for GHC. +package text + flags: -simdutf + +-- formatting (>= 7.2) allows us do drop double-conversion (which again is one +-- of the offending c++ dependencies) +package formatting + flags: +no-double-conversion + tests: True test-show-details: direct diff --git a/flake.nix b/flake.nix index 460049c5ea..80c4f7c410 100644 --- a/flake.nix +++ b/flake.nix @@ -85,8 +85,8 @@ # we also want cross compilation to windows on linux (and only with default compiler). crossPlatforms = p: - lib.optional (system == "x86_64-linux" && config.compiler-nix-name == mingwVersion) - p.mingwW64; + lib.optionals (system == "x86_64-linux" && config.compiler-nix-name == mingwVersion) + [ p.mingwW64 p.aarch64-multiplatform-musl ]; # CHaP input map, so we can find CHaP packages (needs to be more # recent than the index-state we set!). Can be updated with From 6183e1eeb238bdce834d25bbd2535b907a737836 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 5 Jul 2024 03:50:29 +0000 Subject: [PATCH 2/4] add x86_64-linux (static) --- flake.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 80c4f7c410..3c782f7faa 100644 --- a/flake.nix +++ b/flake.nix @@ -86,7 +86,12 @@ # we also want cross compilation to windows on linux (and only with default compiler). crossPlatforms = p: lib.optionals (system == "x86_64-linux" && config.compiler-nix-name == mingwVersion) - [ p.mingwW64 p.aarch64-multiplatform-musl ]; + [ + p.mingwW64 # x86_64-windows + p.aarch64-multiplatform-musl # aarch64-linux (static) + p.musl64 # x86_64-linux (static) + + ]; # CHaP input map, so we can find CHaP packages (needs to be more # recent than the index-state we set!). Can be updated with From 4a78e1caccc3436a93bcfc983b5ffeb71f13b5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Fri, 5 Jul 2024 11:22:32 +0200 Subject: [PATCH 3/4] release-upload.yaml: release aarch64-linux static binary + use x86_64-linux static binary --- .github/workflows/release-upload.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-upload.yml b/.github/workflows/release-upload.yml index 7fa1022ca9..7820d70712 100644 --- a/.github/workflows/release-upload.yml +++ b/.github/workflows/release-upload.yml @@ -135,7 +135,7 @@ jobs: strategy: matrix: # TODO generalize - arch: [x86_64-linux, x86_64-darwin, aarch64-darwin] + arch: [x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux] name: "Download Asset" runs-on: ubuntu-latest steps: @@ -153,7 +153,23 @@ jobs: nix flake metadata "${{ needs.wait_for_hydra.outputs.FLAKE_REF }}" --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_ENV" - name: Build run: | - derivation="hydraJobs.${{ matrix.arch }}.packages.cardano-cli:exe:cardano-cli" + derivation="hydraJobs." + case ${{ matrix.arch }} in + "x86_64-darwin" | "aarch64-darwin") + derivation+="${{ matrix.arch }}" + ;; + "x86_64-linux") + derivation+="x86_64-linux.x86_64-unknown-linux-musl" + ;; + "aarch64-linux") + derivation+="x86_64-linux.aarch64-unknown-linux-musl" + ;; + *) + echo "Unexpected matrix.arch value: ${{ matrix.arch }}" + exit 1 + ;; + esac + derivation+=".packages.cardano-cli:exe:cardano-cli" nix build --builders "" --max-jobs 0 ${{ env.LOCKED_URL }}#$derivation tree result cp result/bin/cardano-cli cardano-cli-${{ matrix.arch }} # (1) @@ -178,7 +194,7 @@ jobs: # (2) # 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 - for arch in x86_64-linux x86_64-darwin aarch64-darwin; do + for arch in x86_64-linux x86_64-darwin aarch64-darwin aarch64-linux; do tar -czf ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-$arch.tar.gz cardano-cli-$arch done # TODO generalize @@ -186,7 +202,7 @@ jobs: - name: Checksums run: | # (3) - for arch in x86_64-linux x86_64-darwin aarch64-darwin; do + for arch in x86_64-linux x86_64-darwin aarch64-darwin aarch64-linux; do sha256sum ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-$arch.tar.gz >> ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-sha256sums.txt done - name: Create short tag @@ -213,5 +229,6 @@ jobs: ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-x86_64-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 + ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-aarch64-linux.tar.gz ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-sha256sums.txt body_path: RELEASE_CHANGELOG.md From 8287ffe863380e094a55d843b0ee22adf26c4506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Fri, 5 Jul 2024 11:40:49 +0200 Subject: [PATCH 4/4] release-upload.yaml: fix old mistake that had impact when testing --- .github/workflows/release-upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-upload.yml b/.github/workflows/release-upload.yml index 7820d70712..7d80cea8a3 100644 --- a/.github/workflows/release-upload.yml +++ b/.github/workflows/release-upload.yml @@ -91,7 +91,7 @@ jobs: echo "TARGET_TAG=$target_tag" >> "$GITHUB_ENV" echo "TARGET_TAG=$target_tag" >> "$GITHUB_OUTPUT" - flake_ref="github:${{ github.repository }}/${{ env.TARGET_TAG }}" + flake_ref="github:${{ github.repository }}/$target_tag" echo "FLAKE_REF=$flake_ref" >> "$GITHUB_OUTPUT" echo "DRY_RUN=$dry_run" >> "$GITHUB_OUTPUT"