fork/helix
git clone https://git.julia.blue/fork/helix
3c230c9b
25.07.1
1name : Release 2on : 3push : 4tags : 5- '[0-9]+.[0-9]+' 6- '[0-9]+.[0-9]+.[0-9]+' 7branches : 8- 'patch/ci-release-*' 9pull_request : 10paths : 11- '.github/workflows/release.yml' 12 13env : 14# Preview mode: Publishes the build output as a CI artifact instead of creating 15# a release, allowing for manual inspection of the output. This mode is 16# activated if the CI run was triggered by events other than pushed tags, or 17# if the repository is a fork. 18preview : ${{ !startsWith(github.ref, 'refs/tags/') || github.repository != 'helix-editor/helix' }} 19 20jobs : 21fetch-grammars : 22name : Fetch Grammars 23runs-on : ubuntu-latest 24steps : 25- name : Checkout sources 26uses : actions/checkout@v4 27 28- name : Install stable toolchain 29uses : dtolnay/rust-toolchain@stable 30 31- uses : Swatinem/rust-cache@v2 32 33- name : Fetch tree-sitter grammars 34run : cargo run --package=helix-loader --bin=hx-loader 35 36- name : Bundle grammars 37run : tar cJf grammars.tar.xz -C runtime/grammars/sources . 38 39- uses : actions/upload-artifact@v4 40with : 41name : grammars 42path : grammars.tar.xz 43 44dist : 45name : Dist 46needs : [ fetch-grammars ] 47env : 48# For some builds, we use cross to test on 32-bit and big-endian 49# systems. 50CARGO : cargo 51# When CARGO is set to CROSS, this is set to `--target matrix.target`. 52TARGET_FLAGS : 53# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. 54TARGET_DIR : ./target 55# Emit backtraces on panics. 56RUST_BACKTRACE : 1 57runs-on : ${{ matrix.os }} 58strategy : 59fail-fast : false # don't fail other jobs if one fails 60matrix : 61build : [ x86_64-linux , aarch64-linux , x86_64-macos , x86_64-windows ] #, x86_64-win-gnu, win32-msvc 62include : 63- build : x86_64-linux 64# WARN: When changing this to a newer version, make sure that the GLIBC isnt too new, as this can cause issues 65# with portablity on older systems that dont follow ubuntus more rapid release cadence. 66os : ubuntu-22.04 67rust : stable 68target : x86_64-unknown-linux-gnu 69cross : false 70- build : aarch64-linux 71# Version should be kept in lockstep with the x86_64 version 72os : ubuntu-22.04-arm 73rust : stable 74target : aarch64-unknown-linux-gnu 75cross : false 76# - build: riscv64-linux 77# os: ubuntu-22.04 78# rust: stable 79# target: riscv64gc-unknown-linux-gnu 80# cross: true 81- build : x86_64-macos 82os : macos-latest 83rust : stable 84target : x86_64-apple-darwin 85cross : false 86- build : x86_64-windows 87os : windows-latest 88rust : stable 89target : x86_64-pc-windows-msvc 90cross : false 91# 23.03: build issues 92- build : aarch64-macos 93os : macos-latest 94rust : stable 95target : aarch64-apple-darwin 96cross : false 97skip_tests : true # x86_64 host can't run aarch64 code 98# - build: x86_64-win-gnu 99# os: windows-2019 100# rust: stable-x86_64-gnu 101# target: x86_64-pc-windows-gnu 102# - build: win32-msvc 103# os: windows-2019 104# rust: stable 105# target: i686-pc-windows-msvc 106 107steps : 108- name : Checkout sources 109uses : actions/checkout@v4 110 111- name : Download grammars 112uses : actions/download-artifact@v4 113 114- name : Move grammars under runtime 115if : "!startsWith(matrix.os, 'windows')" 116run : | 117mkdir -p runtime/grammars/sources 118tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources 119 120# The rust-toolchain action ignores rust-toolchain.toml files. 121# Removing this before building with cargo ensures that the rust-toolchain 122# is considered the same between installation and usage. 123- name : Remove the rust-toolchain.toml file 124run : rm rust-toolchain.toml 125 126- name : Install ${{ matrix.rust }} toolchain 127uses : dtolnay/rust-toolchain@master 128with : 129toolchain : ${{ matrix.rust }} 130target : ${{ matrix.target }} 131 132# Install a pre-release version of Cross 133# TODO: We need to pre-install Cross because we need cross-rs/cross#591 to 134# get a newer C++ compiler toolchain. Remove this step when Cross 135# 0.3.0, which includes cross-rs/cross#591, is released. 136- name : Install Cross 137if : "matrix.cross" 138run : | 139cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a 140echo "CARGO=cross" >> $GITHUB_ENV 141# echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV 142# echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV 143 144- name : Show command used for Cargo 145run : | 146echo "cargo command is: ${{ env.CARGO }}" 147echo "target flag is: ${{ env.TARGET_FLAGS }}" 148 149- name : Run cargo test 150if : "!matrix.skip_tests" 151run : ${{ env.CARGO }} test --release --locked --target ${{ matrix.target }} --workspace 152 153- name : Build release binary 154run : ${{ env.CARGO }} build --profile opt --locked --target ${{ matrix.target }} 155 156- name : Build AppImage 157shell : bash 158if : matrix.build == 'x86_64-linux' 159run : | 160# Required as of 22.x https://github.com/AppImage/AppImageKit/wiki/FUSE 161sudo add-apt-repository universe 162sudo apt install libfuse2 163 164mkdir dist 165 166name=dev 167if [[ $GITHUB_REF == refs/tags/* ]]; then 168name=${GITHUB_REF:10} 169fi 170 171build="${{ matrix.build }}" 172 173export VERSION="$name" 174export ARCH=${build%-linux} 175export APP=helix 176export OUTPUT="helix-$VERSION-$ARCH.AppImage" 177export UPDATE_INFORMATION="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|helix|latest|$APP-*-$ARCH.AppImage.zsync" 178 179mkdir -p "$APP.AppDir"/usr/{bin,lib/helix} 180 181cp "target/${{ matrix.target }}/opt/hx" "$APP.AppDir/usr/bin/hx" 182rm -rf runtime/grammars/sources 183cp -r runtime "$APP.AppDir/usr/lib/helix/runtime" 184 185cat << 'EOF' > "$APP.AppDir/AppRun" 186#!/bin/sh 187 188APPDIR="$(dirname "$(readlink -f "${0}")")" 189HELIX_RUNTIME="$APPDIR/usr/lib/helix/runtime" exec "$APPDIR/usr/bin/hx" "$@" 190EOF 191chmod 755 "$APP.AppDir/AppRun" 192 193curl -Lo linuxdeploy-x86_64.AppImage \ 194https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage 195chmod +x linuxdeploy-x86_64.AppImage 196 197./linuxdeploy-x86_64.AppImage \ 198--appdir "$APP.AppDir" -d contrib/Helix.desktop \ 199-i contrib/helix.png --output appimage 200 201mv "$APP-$VERSION-$ARCH.AppImage" \ 202"$APP-$VERSION-$ARCH.AppImage.zsync" dist 203 204- name : Build Deb 205shell : bash 206if : matrix.build == 'x86_64-linux' 207run : | 208cargo install cargo-deb 209mkdir -p target/release 210cp target/${{ matrix.target }}/opt/hx target/release/ 211cargo deb --no-build 212mkdir -p dist 213mv target/debian/*.deb dist/ 214 215- name : Build archive 216shell : bash 217run : | 218mkdir -p dist 219if [ "${{ matrix.os }}" = "windows-2019" ]; then 220cp "target/${{ matrix.target }}/opt/hx.exe" "dist/" 221else 222cp "target/${{ matrix.target }}/opt/hx" "dist/" 223fi 224if [ -d runtime/grammars/sources ]; then 225rm -rf runtime/grammars/sources 226fi 227cp -r runtime dist 228 229- uses : actions/upload-artifact@v4 230with : 231name : bins-${{ matrix.build }} 232path : dist 233 234publish : 235name : Publish 236needs : [ dist ] 237runs-on : ubuntu-latest 238steps : 239- name : Checkout sources 240uses : actions/checkout@v4 241 242- uses : actions/download-artifact@v4 243 244- name : Build archive 245shell : bash 246run : | 247set -ex 248 249source="$(pwd)" 250tag=${GITHUB_REF_NAME//\//} 251mkdir -p runtime/grammars/sources 252tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources 253rm -rf grammars 254 255cd "$(mktemp -d)" 256mv $source/bins-* . 257mkdir dist 258 259for dir in bins-* ; do 260platform=${dir#"bins-"} 261if [[ $platform =~ "windows" ]]; then 262exe=".exe" 263fi 264pkgname=helix-$tag-$platform 265mkdir -p $pkgname 266cp $source/LICENSE $source/README.md $pkgname 267mkdir $pkgname/contrib 268cp -r $source/contrib/completion $pkgname/contrib 269mv bins-$platform/runtime $pkgname/ 270mv bins-$platform/hx$exe $pkgname 271chmod +x $pkgname/hx$exe 272 273if [[ "$platform" = "x86_64-linux" ]]; then 274mv bins-$platform/helix-*.AppImage* dist/ 275mv bins-$platform/*.deb dist/ 276fi 277 278if [ "$exe" = "" ]; then 279tar cJf dist/$pkgname.tar.xz $pkgname 280else 2817z a -r dist/$pkgname.zip $pkgname 282fi 283done 284 285tar cJf dist/helix-$tag-source.tar.xz -C $source . 286mv dist $source/ 287 288- name : Upload binaries to release 289uses : svenstaro/upload-release-action@v2 290if : env.preview == 'false' 291with : 292repo_token : ${{ secrets.GITHUB_TOKEN }} 293file : dist/* 294file_glob : true 295tag : ${{ github.ref_name }} 296overwrite : true 297 298- name : Upload binaries as artifact 299uses : actions/upload-artifact@v4 300if : env.preview == 'true' 301with : 302name : release 303path : dist/*