Skip to content

feat(ci): support windows builds (#39) #8

feat(ci): support windows builds (#39)

feat(ci): support windows builds (#39) #8

Workflow file for this run

name: "evil-helix - build tag"
on:
push:
tags:
- "release-*"
permissions: write-all
env:
RUST_BACKTRACE: 1
RUST_BUILD_PROFILE: opt
HELIX_LOG_LEVEL: info
HELIX_DEFAULT_RUNTIME: /opt/helix/runtime
BINSTALL_DISABLE_TELEMETRY: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
target:
- id: x86_64-unknown-linux-gnu
name: amd64-linux
native: true
os: ubuntu-latest
- id: aarch64-unknown-linux-gnu
name: aarch64-linux
native: false
os: ubuntu-latest
- id: aarch64-unknown-linux-musl
name: aarch64-linux-musl
native: false
os: ubuntu-latest
- id: arm-unknown-linux-musleabihf
name: armv6-linux-musl
native: false
os: ubuntu-latest
- id: x86_64-apple-darwin
name: amd64-macos
native: true
os: macos-latest
- id: aarch64-apple-darwin
name: aarch64-macos
native: true
os: macos-latest
- id: x86_64-pc-windows-gnu
name: amd64-windows
native: false
os: ubuntu-latest
runs-on: ${{ matrix.target.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@1.74
with:
targets: ${{ matrix.target.id }}
- name: Install binstall
uses: "cargo-bins/cargo-binstall@v1.6.5"
if: ${{ !matrix.target.native }}
- name: "Install cross"
run: "cargo binstall -y cross"
if: ${{ !matrix.target.native }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build"
- name: Build
shell: bash
run: |
rustup target add ${{ matrix.target.id }}
cargo build --target ${{ matrix.target.id }} --profile $RUST_BUILD_PROFILE
if: ${{ matrix.target.native }}
- name: Build (cross)
shell: bash
run: cross build --target ${{ matrix.target.id }} --profile $RUST_BUILD_PROFILE
if: ${{ !matrix.target.native }}
- name: "Prepare dist"
shell: bash
run: |
mkdir -pv dist/helix
if [ -f target/${{ matrix.target.id }}/$RUST_BUILD_PROFILE/hx ]; then
mv -v target/${{ matrix.target.id }}/$RUST_BUILD_PROFILE/hx dist/helix/
else
mv -v target/${{ matrix.target.id }}/$RUST_BUILD_PROFILE/hx.exe dist/helix/
fi
rm -rf runtime/grammars/sources
mv -v runtime dist/helix/
#cd dist
#if [[ "$RUNNER_OS" != "Windows" ]]; then
# tar -cvzf "evil-helix-${{ matrix.target.name }}.tar.gz" helix
#fi
- name: "Compress dist (tar)"
shell: bash
run: |
cd dist
tar -cvzf "evil-helix-${{ matrix.target.name }}.tar.gz" helix
if: ${{ matrix.target.id != 'x86_64-pc-windows-msvc' }}
- name: "Compress dist (zip)"
run: |
cd dist
Compress-Archive -Path helix -Destination "evil-helix-${{ matrix.target.name }}.zip"
if: ${{ matrix.target.id == 'x86_64-pc-windows-msvc' }}
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: "evil-helix-${{ matrix.target.name }}"
path: "dist/evil-helix-${{ matrix.target.name }}.*"
- name: Release suffix
id: release-suffix
run: echo "::set-output name=suffix::$(date +'%Y%m%d')"
- name: Create release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/evil-helix-*.*
file_glob: true
tag: ${{ github.ref }}
release_name: evil-helix-${{steps.release-suffix.outputs.suffix}}
overwrite: true
draft: true