forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (173 loc) · 5.67 KB
/
integration-tests.yml
File metadata and controls
188 lines (173 loc) · 5.67 KB
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
name: Integration tests
on:
pull_request:
push:
branches:
- master
- stable
- rc/**
tags:
- '**'
workflow_dispatch:
# As of 11 August 2022, ubuntu-latest, windows-latest and macos-latest come with
# Stack 2.7.5. windows-latest comes with NSIS 3.08, for which the default value
# of the 'Unicode' installer attribute is 'true'.
jobs:
integration-tests:
name: Integration tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
release-args: "--alpine"
cache-bust: ""
- os: windows-latest
release-args: ""
cache-bust: "13"
- os: macos-latest
release-args: ""
cache-bust: "23"
steps:
- name: Clone project
uses: actions/checkout@v3
- name: Cache dependencies on Unix-like OS
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}-${{ matrix.cache-bust }}
- name: Cache dependencies on Windows
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v3
with:
path: |
~\AppData\Roaming\stack
~\AppData\Local\Programs\stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}-${{ matrix.cache-bust }}
- name: Install deps and run checks
shell: bash
run: |
set -ex
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]
then
# Retry installing nix due to nondeterministic error
# Fatal error: glibc detected an invalid stdio handle
# See:
# https://github.com/nh2/static-haskell-nix/pull/27#issuecomment-502652181
# https://github.com/NixOS/nix/issues/2733
(for i in {1..5}; do bash <(curl -sSL https://nixos.org/nix/install) --no-daemon && exit 0; done; exit 1)
. ~/.nix-profile/etc/profile.d/nix.sh
nix-channel --add https://nixos.org/channels/nixos-22.05 nixpkgs
nix-channel --update # Get GHC 8.2.2
fi
if [[ "${{ matrix.release-args }}" == "--alpine" ]]
then
mkdir -p ~/.stack
touch ~/.stack/config.yaml
cat > ~/.stack/config.yaml <<EOF
extra-include-dirs:
- /usr/include
extra-lib-dirs:
- /lib
- /usr/lib
EOF
fi
# Do this in the same step as installing deps to get relevant env var modifications
stack etc/scripts/release.hs check ${{ matrix.release-args }}
set +ex
- name: Build bindist
shell: bash
run: stack etc/scripts/release.hs build ${{ matrix.release-args }}
- name: Upload bindist
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}
path: _release/stack-*
github-release:
name: Create Github release
needs: integration-tests
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v3
with:
name: Linux
path: _release
- name: Download macOS artifact
uses: actions/download-artifact@v3
with:
name: macOS
path: _release
- name: Download Windows artifact
uses: actions/download-artifact@v3
with:
name: Windows
path: _release
- name: Hash and sign assets
shell: bash
env:
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
run: |
set -e
echo "$RELEASE_SIGNING_KEY"|gpg --import
cd _release
for asset in *; do
shasum -a 256 "$asset" >"$asset.sha256"
gpg --digest-algo=sha512 --detach-sig --armor -u 0x575159689BEFB442 "$asset"
done
- name: Set Github ref variables
id: github_ref_vars
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Create Github release (final)
if: "!startsWith(github.ref, 'refs/tags/rc/')"
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
See https://haskellstack.org/ for installation and upgrade instructions.
**Changes since v[INSERT PREVIOUS VERSION]:**
[INSERT CHANGELOG]
**Thanks to all our contributors for this release:**
[INSERT CONTRIBUTORS]
draft: true
prerelease: false
- name: Create Github release (release candidate)
if: "startsWith(github.ref, 'refs/tags/rc/')"
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body: |
**Changes since v[INSERT PREVIOUS VERSION]:**
[INSERT CHANGELOG]
draft: true
prerelease: true
- name: Upload assets to Github release (final)
if: "!startsWith(github.ref, 'refs/tags/rc/')"
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "_release/*"
tag_name: ${{ steps.github_ref_vars.outputs.SOURCE_TAG }}
draft: true
prerelease: false
overwrite: true
- name: Upload assets to Github release (release candidate)
if: "startsWith(github.ref, 'refs/tags/rc/')"
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "_release/*"
tag_name: ${{ steps.github_ref_vars.outputs.SOURCE_TAG }}
draft: true
prerelease: true
overwrite: true