feat(ci): support windows builds #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "evil-helix - build pr" | |
on: | |
pull_request: | |
workflow_dispatch: | |
permissions: write-all | |
env: | |
RUST_BACKTRACE: 1 | |
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 | |
# TODO: move this to evil-build-tag | |
# TODO: let's first see if this works | |
- id: x86_64-pc-windows-msvc | |
#- 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/[email protected] | |
with: | |
targets: ${{ matrix.target.id }} | |
- name: Install binstall | |
uses: "cargo-bins/[email protected]" | |
if: ${{ !matrix.target.native}} | |
- name: "Install cross" | |
run: | | |
# TODO: let's first see if this works | |
cargo binstall -y cargo-xwin | |
#cargo binstall -y cargo-zigbuild | |
#cargo binstall -y cross | |
if: ${{ !matrix.target.native}} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "build" | |
- name: Build | |
run: | | |
rustup target add ${{ matrix.target.id }} | |
cargo build --target ${{ matrix.target.id }} --profile release | |
if: ${{ matrix.target.native}} | |
- name: Load rust target | |
run: "rustup target add ${{ matrix.target.id }}" | |
if: ${{ !matrix.target.native}} | |
- name: Build (cross) | |
# TODO: let's first see if this works | |
run: cargo xwin build --target ${{ matrix.target.id }} --profile release | |
#run: cargo zigbuild --target ${{ matrix.target.id }} --profile release | |
#run: cross build --target ${{ matrix.target.id }} --profile release | |
if: ${{ !matrix.target.native}} | |
- name: "Prepare dist" | |
run: | | |
mkdir -pv dist/helix | |
if [ -f target/${{ matrix.target.id }}/release/hx ]; then | |
mv -v target/${{ matrix.target.id }}/release/hx dist/helix/ | |
else | |
mv -v target/${{ matrix.target.id }}/release/hx.exe dist/helix/ | |
fi | |
rm -rf runtime/grammars/sources | |
mv -v runtime dist/helix/ | |
cd dist && tar -cvzf helix-${{ matrix.target.name }}.tar.gz helix | |
- name: "Upload artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: helix-${{ matrix.target.name }} | |
path: dist/helix-${{ matrix.target.name }}.tar.gz |