Arm builds (#12961)

Conrad Irwin created

Release Notes:

- N/A

Change summary

.cargo/config.toml       |  6 ++
.github/workflows/ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++++
script/generate-licenses |  1 
3 files changed, 89 insertions(+), 1 deletion(-)

Detailed changes

.cargo/config.toml 🔗

@@ -6,5 +6,9 @@ rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"]
 xtask = "run --package xtask --"
 
 [target.x86_64-unknown-linux-gnu]
-linker = "/usr/bin/clang"
+linker = "clang"
+rustflags = ["-C", "link-arg=-fuse-ld=mold"]
+
+[target.aarch64-unknown-linux-gnu]
+linker = "clang"
 rustflags = ["-C", "link-arg=-fuse-ld=mold"]

.github/workflows/ci.yml 🔗

@@ -325,3 +325,86 @@ jobs:
           body: ""
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+  bundle-linux-aarch64:
+    timeout-minutes: 60
+    name: Create arm64 Linux bundle
+    runs-on:
+      - hosted-linux-arm-1
+    if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
+    needs: [linux_tests]
+    env:
+      ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
+    steps:
+      - name: Checkout repo
+        uses: actions/checkout@v4
+        with:
+          clean: false
+      - name: "Setup jq"
+        uses: dcarbone/install-jq-action@v2
+
+      - name: Set up Clang
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y llvm-10 clang-10 build-essential cmake pkg-config libasound2-dev libfontconfig-dev libwayland-dev libxkbcommon-x11-dev libssl-dev libzstd-dev libvulkan1 libgit2-dev
+          echo "/usr/lib/llvm-10/bin" >> $GITHUB_PATH
+
+      - uses: rui314/setup-mold@v1
+        with:
+          mold_version: 2.32.0
+
+      - name: rustup
+        run: |
+          curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
+
+      - name: Limit target directory size
+        run: script/clear-target-dir-if-larger-than 100
+
+      - name: Determine version and release channel
+        if: ${{ startsWith(github.ref, 'refs/tags/v') }}
+        run: |
+          set -eu
+
+          version=$(script/get-crate-version zed)
+          channel=$(cat crates/zed/RELEASE_CHANNEL)
+          echo "Publishing version: ${version} on release channel ${channel}"
+          echo "RELEASE_CHANNEL=${channel}" >> $GITHUB_ENV
+
+          expected_tag_name=""
+          case ${channel} in
+            stable)
+              expected_tag_name="v${version}";;
+            preview)
+              expected_tag_name="v${version}-pre";;
+            nightly)
+              expected_tag_name="v${version}-nightly";;
+            *)
+              echo "can't publish a release on channel ${channel}"
+              exit 1;;
+          esac
+          if [[ $GITHUB_REF_NAME != $expected_tag_name ]]; then
+            echo "invalid release tag ${GITHUB_REF_NAME}. expected ${expected_tag_name}"
+            exit 1
+          fi
+
+      - name: Create and upload Linux .tar.gz bundle
+        run: script/bundle-linux
+
+      - name: Upload Linux bundle to workflow run if main branch or specific label
+        uses: actions/upload-artifact@v4
+        if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
+        with:
+          name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
+          path: target/release/zed-*.tar.gz
+
+      - name: Upload app bundle to release
+        uses: softprops/action-gh-release@v1
+        if: ${{ env.RELEASE_CHANNEL == 'preview' }}
+        with:
+          draft: true
+          prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
+          files: target/release/zed-linux-aarch64.tar.gz
+          body: ""
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

script/generate-licenses 🔗

@@ -17,6 +17,7 @@ echo -e "# ###### CODE LICENSES ######\n" >> $OUTPUT_FILE
 [[ "$(cargo about --version)" == "cargo-about 0.6.1" ]] || cargo install cargo-about@0.6.1
 
 echo "Generating cargo licenses"
+cargo install cargo-about
 cargo about generate --fail -c script/licenses/zed-licenses.toml script/licenses/template.hbs.md >> $OUTPUT_FILE