feat(ci): support windows builds #51
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 | |
RUST_BUILD_PROFILE: release | |
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: x86_64-pc-windows-msvc | |
name: amd64-windows | |
native: true | |
os: windows-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 | |
run: | | |
rustup target add ${{ matrix.target.id }} | |
cargo build --target ${{ matrix.target.id }} --profile $BUILD_PROFILE | |
if: ${{ matrix.target.native}} | |
- name: Build (cross) | |
run: cross build --target ${{ matrix.target.id }} --profile $BUILD_PROFILE | |
if: ${{ !matrix.target.native}} | |
- name: "Prepare dist" | |
shell: bash | |
run: | | |
mkdir -pv dist/helix | |
if [ -f target/${{ matrix.target.id }}/$BUILD_PROFILE/hx ]; then | |
mv -v target/${{ matrix.target.id }}/$BUILD_PROFILE/hx dist/helix/ | |
else | |
mv -v target/${{ matrix.target.id }}/$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: "Upload artifacts (tar)" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "evil-helix-${{ matrix.target.name }}" | |
path: "dist/evil-helix-${{ matrix.target.name }}.tar.gz" | |
- name: "Upload artifacts (zip)" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "evil-helix-${{ matrix.target.name }}" | |
path: "dist/helix" |