Build binaries #77
Workflow file for this run
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: Build binaries | |
on: | |
release: | |
types: [published] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
system: x86_64-linux | |
attr: native | |
- os: macOS-latest | |
system: aarch64-darwin | |
attr: native | |
- os: macOS-latest | |
system: x86_64-darwin | |
attr: native | |
- os: ubuntu-latest | |
system: x86_64-linux | |
attr: windows | |
name: Build ${{ matrix.attr }} binary on ${{ matrix.system }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v26 | |
with: | |
extra_nix_config: | | |
accept-flake-config = true | |
- name: Get target system | |
id: system | |
run: | | |
echo -n "SYSTEM=" >> "$GITHUB_OUTPUT" | |
nix eval -L --system ${{ matrix.system }} .#binaries/${{ matrix.attr }} \ | |
--apply 'd: d.stdenv.hostPlatform.system' >> "$GITHUB_OUTPUT" | |
echo >> "$GITHUB_OUTPUT" | |
- name: Build binary | |
run: | | |
nix build -L --system ${{ matrix.system }} .#binaries/${{ matrix.attr }} | |
- name: Prepare upload | |
run: | | |
cd result/bin | |
7z a -l ${{ github.workspace }}/ormolu.zip . | |
- uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ormolu.zip | |
asset_name: ormolu-${{ steps.system.outputs.SYSTEM }}.zip | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
system: x86_64-linux | |
- os: macOS-latest | |
system: aarch64-darwin | |
- os: macOS-latest | |
system: x86_64-darwin | |
- os: windows-latest | |
system: x86_64-windows | |
name: Test built binaries | |
runs-on: ${{ matrix.os }} | |
needs: build | |
steps: | |
- name: Download and extract binary | |
run: | | |
curl -sL https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/ormolu-${{ matrix.system }}.zip > ormolu.zip | |
7z e ormolu.zip | |
- name: Basic functionality tests | |
run: | | |
./ormolu --version | |
echo "data A = A" > test.hs | |
./ormolu -m check test.hs |