-
Notifications
You must be signed in to change notification settings - Fork 841
170 lines (155 loc) · 5.3 KB
/
integration-tests.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Integration tests
on:
pull_request:
push:
branches:
- master
- stable
- rc/**
tags:
- '**'
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
integration-tests:
name: Integration tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
release-args: "--alpine"
- os: windows-latest
release-args: ""
- os: macos-latest
release-args: ""
steps:
- name: Clone project
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }}
- shell: bash
name: Install deps and run checks
run: |
set -ex
# Work around 'git status' always showing symlinks modified on Windows; see
# https://github.com/git-for-windows/git/issues/2653#issuecomment-640234081
git config --global core.fscache false
stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
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) && exit 0; done; exit 1)
. ~/.nix-profile/etc/profile.d/nix.sh
nix-channel --add https://nixos.org/channels/nixos-19.09 nixpkgs
nix-channel --update # Get GHC 8.2.2
elif [[ "${{ matrix.os }}" == "windows-latest" ]]
then
choco install nsis-unicode -y
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
- shell: bash
name: Build bindist
run: stack etc/scripts/release.hs build ${{ matrix.release-args }}
- name: Upload bindist
uses: actions/upload-artifact@v2
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@v2
with:
name: Linux
path: _release
- name: Download macOS artifact
uses: actions/download-artifact@v2
with:
name: macOS
path: _release
- name: Download Windows artifact
uses: actions/download-artifact@v2
with:
name: Windows
path: _release
- shell: bash
name: Hash and sign assets
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