-
Notifications
You must be signed in to change notification settings - Fork 53
151 lines (127 loc) · 4.74 KB
/
haskell-release.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Release
on:
# Trigger the workflow on the new PVP version tag created.
# https://pvp.haskell.org/
# See patterns explanation at:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+.[0-9]+*"
jobs:
build-binaries:
name: Haskell-Release - ${{ matrix.os }} - ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 points to x64 based OS and macos-latest points to arm based OS
os:
- ubuntu-latest
- macos-latest
- macos-13
cabal:
- 3.12.1.0
ghc:
- 9.8.2
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Freeze
run: cabal freeze
- name: cache
uses: actions/cache@v4
with:
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
restore-keys: |
${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
${{ matrix.os }}-${{ matrix.ghc }}-
- name: Install dependencies
run: |
cabal v2-build --disable-tests --disable-benchmarks --dependencies-only -j2 all
- name: Build binary
run: |
mkdir dist
cabal v2-install exe:swarm --install-method=copy --overwrite-policy=always --installdir=dist
- name: Set binary path name
run: echo BINARY_PATH="./dist/swarm" >> "$GITHUB_ENV"
- if: matrix.os == 'ubuntu-latest'
name: Set binary OS name on Ubuntu
run: echo BINARY_OS=${{ runner.os }} >> "$GITHUB_ENV"
- if: (matrix.os == 'macos-13') || (matrix.os == 'macos-latest')
name: Set binary OS name on Macos
run: echo BINARY_OS="Darwin" >> "$GITHUB_ENV"
- name: Set binary Arch name
run: echo ARCH="x86_64" >> "$GITHUB_ENV"
- if: matrix.os == 'macos-latest'
name: Set binary ARCH name for apple silicon
run: echo ARCH="arm64" >> "$GITHUB_ENV"
- name: Upload executables
uses: actions/upload-artifact@v4
with:
name: swarm-${{ env.BINARY_OS }}-${{env.ARCH}}
path: ${{ env.BINARY_PATH }}
retention-days: 3
create-release:
name: Create release
needs: [build-binaries]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download Linux x86_64
uses: actions/download-artifact@v4
with:
name: swarm-Linux-x86_64
path: artifacts/swarm-Linux-x86_64
- name: Download executable for Macos x86_64
uses: actions/download-artifact@v4
with:
name: swarm-Darwin-x86_64
path: artifacts/swarm-Darwin-x86_64
- name: Download executable for arm64 Macos
uses: actions/download-artifact@v4
with:
name: swarm-Darwin-arm64
path: artifacts/swarm-Darwin-arm64
- name: Download Swarm data
uses: actions/download-artifact@v4
with:
name: swarm-data.zip
path: artifacts/swarm-Darwin-arm64
- name: Rename executables
run: |
mv artifacts/swarm-Linux-x86_64/swarm swarm-Linux-x86_64
mv artifacts/swarm-Darwin-x86_64/swarm swarm-Darwin-x86_64
mv artifacts/swarm-Darwin-arm64/swarm swarm-Darwin-arm64
- name: Zip data directory
run: zip -r swarm-data.zip ./data || { echo "Unable to create a zip archive."; exit 1; }
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: swarm
draft: false
prerelease: false
files: |
swarm-Linux-x86_64
swarm-Darwin-x86_64
swarm-Darwin-arm64
LICENSE
swarm-data.zip
# - name: Generate documentation for Hackage
# # The hackage-server attempts to build documentation for library packages, but this can fail.
# # If it does we can do it ourselves
# run: cabal v2-haddock --builddir=docs --haddock-for-hackage --enable-doc
- uses: haskell-actions/hackage-publish@v1
with:
hackageToken: "${{ secrets.HACKAGE_AUTH_TOKEN }}"
packagesPath: dist-newstyle/sdist
# docsPath: docs
publish: true