222 lines (183 loc) · 6.74 KB
/
release.yaml
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Create Release
on:
push:
tags:
- 'v*'
jobs:
draft_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: true
prerelease: false
release-linux:
name: Create Release for Linux (static)
needs: draft_release
runs-on: ubuntu-latest
container: alpine:3.12
steps:
- name: Install system dependencies
run: |
apk add --no-cache curl gcc g++ gmp-dev ncurses-dev libffi-dev make xz gzip tar perl git bash sudo binutils-gold
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
- name: Install ghcup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://downloads.haskell.org/~ghcup/0.1.11/x86_64-linux-ghcup-0.1.11 > /usr/bin/ghcup
chmod +x /usr/bin/ghcup
echo "::add-path::$HOME/.ghcup/bin"
shell: bash
- name: Install GHC and cabal
run: |
ghcup install ghc 8.8.4
ghcup set ghc 8.8.4
ghcup install cabal 3.2.0.0
shell: bash
- name: Update cabal cache
run: cabal update
shell: bash
- name: Checkout code
uses: actions/checkout@v2
- name: create ~/.local/bin
run: mkdir -p "$HOME/.local/bin"
shell: bash
- name: Add ~/.local/bin to PATH
run: echo "::add-path::$HOME/.local/bin"
- name: Install shelltestrunner
run: cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always shelltestrunner
shell: bash
- name: Install cabal dependencies
run: cabal build --only-dependencies --ghc-options='-split-sections -optl-static'
shell: bash
- name: Install
run: cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always --ghc-options='-split-sections -optl-static'
shell: bash
- name: Strip
run: strip ~/.local/bin/stack2cabal
shell: bash
- name: Run tests
run: cabal test --ghc-options='-split-sections -optl-static' all
shell: bash
- name: Run shelltest tests
run: cabal exec --offline --verbose=0 sh -- -c 'shelltest shelltest.test'
shell: bash
- run: echo ::set-env name=HOME::$HOME
shell: bash
- name: Upload Release Asset (binaries)
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ${{ env.HOME }}/.local/bin/stack2cabal
asset_name: stack2cabal-linux
asset_content_type: application/octet-stream
- name: pack up shell completions
run: |
mkdir -p completions/{bash,zsh,fish}
~/.local/bin/stack2cabal --bash-completion-script stack2cabal > completions/bash/stack2cabal.sh
~/.local/bin/stack2cabal --zsh-completion-script stack2cabal > completions/zsh/_stack2cabal
~/.local/bin/stack2cabal --fish-completion-script stack2cabal > completions/fish/stack2cabal.fish
tar caf completions.tar.gz completions/
shell: bash
- name: Upload Release Asset (completions)
id: upload-release-asset-completions
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ./completions.tar.gz
asset_name: completions.tar.gz
asset_content_type: application/gzip
- if: always()
uses: actions/upload-artifact@v2
with:
name: plan.json
path: ./dist-newstyle/cache/plan.json
release-mac-win:
name: Create Release for macOS/windows
needs: draft_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-haskell@v1.1.2
with:
ghc-version: 8.8.4
cabal-version: 3.2.0.0
- name: create ~/.local/bin
run: mkdir -p "$HOME/.local/bin"
shell: bash
- name: Add ~/.local/bin to PATH
run: echo "::add-path::$HOME/.local/bin"
- name: Update cabal cache
run: cabal update
shell: bash
- name: Install shelltestrunner
run: cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always -f _regex-posix-clib shelltestrunner
shell: bash
- name: Install cabal dependencies
run: cabal build --only-dependencies
shell: bash
- name: Install
run: cabal install --installdir="$HOME/.local/bin" --install-method=copy --overwrite-policy=always
shell: bash
- name: Strip mac
if: matrix.os == 'macOS-latest'
run: strip ~/.local/bin/stack2cabal
shell: bash
- name: Run tests
run: cabal test --ghc-options='-split-sections -optl-static' all
shell: bash
- if: matrix.os == 'macOS-latest'
name: Install git
run: brew install git
- if: matrix.os == 'windows-latest'
name: Install git
run: choco install git
- name: Run shelltest tests
run: cabal exec --offline --verbose=0 sh -- -c 'shelltest shelltest.test'
shell: bash
- run: echo ::set-env name=HOME::$HOME
shell: bash
- if: matrix.os != 'windows-latest'
run: echo ::set-env name=ASSET_PATH::$HOME/.local/bin/stack2cabal
shell: bash
- if: matrix.os == 'windows-latest'
run: echo ::set-env name=ASSET_PATH::C:\\Users\\runneradmin\\.local\\bin\\stack2cabal.exe
shell: bash
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ${{ env.ASSET_PATH }}
asset_name: stack2cabal-${{ matrix.os }}
asset_content_type: application/octet-stream
- if: always()
uses: actions/upload-artifact@v2
with:
name: plan.json
path: ./dist-newstyle/cache/plan.json