-
Notifications
You must be signed in to change notification settings - Fork 82
78 lines (78 loc) · 2.32 KB
/
binaries.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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@V27
with:
extra_nix_config: |
accept-flake-config = true
- name: Get target system
id: system
run: |
( echo -n "SYSTEM="
nix eval -L --system ${{ matrix.system }} .#binaries/${{ matrix.attr }} \
--apply 'd: d.stdenv.hostPlatform.system'
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