Repository navigation
250 lines (225 loc) · 7.7 KB
/
Copy pathci.yml
File metadata and controls
250 lines (225 loc) · 7.7 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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
name: CI
on:
pull_request:
push:
branches: ["main"]
tags: ["v*"]
jobs:
generate-matrix:
name: 'Generate matrix from cabal'
outputs:
test-matrix: ${{ steps.set-test-matrix.outputs.matrix }}
release-matrix: ${{ steps.extend-release-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Extract the tested GHC versions (tests)
id: set-test-matrix
uses: kleidukos/get-tested@v0.1.10.0
with:
cabal-file: ghcup-gui.cabal
ubuntu-version: '24.04,26.04'
version: 0.1.10.0
- name: Extract the tested GHC versions (packages)
id: set-release-matrix
uses: kleidukos/get-tested@v0.1.10.0
with:
cabal-file: ghcup-gui.cabal
ubuntu-version: '24.04,26.04'
macos-version: 'latest'
version: 0.1.10.0
- name: Add the aarch64 Ubuntu runners to the release matrix
id: extend-release-matrix
env:
MATRIX: ${{ steps.set-release-matrix.outputs.matrix }}
run: |
echo "matrix=$(jq -c '.include += [.include[] | select(.os | startswith("ubuntu-")) | .os += "-arm"]' <<< "$MATRIX")" >> "$GITHUB_OUTPUT"
tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.test-matrix) }}
steps:
- uses: actions/checkout@v7
- name: Set up Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure environment
run: |
sudo apt update
sudo apt install -y \
libadwaita-1-dev \
libcairo2-dev \
libfreetype-dev \
libgdk-pixbuf-2.0-dev \
libgirepository1.0-dev \
libglib2.0-dev \
libgraphene-1.0-dev \
libgtk-4-dev \
libharfbuzz-dev \
liblzma-dev \
libpango1.0-dev \
zlib1g-dev
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
cabal freeze
- name: Cache
uses: actions/cache@v6
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
- name: Build
run: |
make build
- name: Test
run: |
cabal test
packages:
name: Packages with ${{ matrix.ghc }} on ${{ matrix.os }}
if: github.event_name == 'push'
needs: [generate-matrix, tests]
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.release-matrix) }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 'latest'
- name: Configure environment (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y \
libadwaita-1-dev \
libcairo2-dev \
libfreetype-dev \
libgdk-pixbuf-2.0-dev \
libgirepository1.0-dev \
libglib2.0-dev \
libgraphene-1.0-dev \
libgtk-4-dev \
libharfbuzz-dev \
liblzma-dev \
libpango1.0-dev \
zlib1g-dev \
rpm \
zstd \
libarchive-tools \
ruby-full \
flatpak \
flatpak-builder
sudo gem install fpm
flatpak remote-add --user --if-not-exists flathub \
https://dl.flathub.org/repo/flathub.flatpakrepo
cabal update
cabal freeze --project-file=cabal.release.project
- name: Configure environment (macOS)
if: runner.os == 'macOS'
run: |
brew install gtk4 libadwaita gobject-introspection pkgconf dylibbundler librsvg
cabal update
cabal freeze --project-file=cabal.release.project
- name: Cache
uses: actions/cache@v6
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: release-${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
restore-keys: release-${{ matrix.os }}-ghc-${{ matrix.ghc }}-
- name: Cache flatpak runtimes
if: startsWith(matrix.os, 'ubuntu-24.04')
uses: actions/cache@v6
with:
path: ~/.local/share/flatpak
key: flatpak-runtimes-${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('packaging/flatpak/org.haskell.GhcupGui.yaml') }}
- name: Install cabal-flatpak
if: startsWith(matrix.os, 'ubuntu-24.04')
working-directory: ${{ runner.temp }}
run: |
cabal install cabal-flatpak-1.0.0 \
--installdir="$HOME/.local/bin" \
--install-method=copy \
--overwrite-policy=always
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Build packages
run: |
FORMATS=()
case "${{ matrix.os }}" in
ubuntu-26.04*) FORMATS=(deb rpm pacman) ;;
ubuntu-24.04*) FORMATS=(deb flatpak tarball) ;;
esac
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
./scripts/package.sh -v "${GITHUB_REF_NAME#v}" ${FORMATS[@]+"${FORMATS[@]}"}
else
./scripts/package.sh -v head ${FORMATS[@]+"${FORMATS[@]}"}
fi
- uses: actions/upload-artifact@v7
with:
name: packages-${{ matrix.os }}-${{ runner.arch }}
path: dist-package/out/*
if-no-files-found: error
release:
name: Publish release
needs: [packages]
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
path: packages
merge-multiple: true
- name: Sign packages
uses: thomasdesr/minisign-action@68f9ff8e1074691a178b8ceb098d3d056aac54a3 # v1.4
with:
args: -Sm packages/*
minisign_key: ${{ secrets.MINISIGN_SECRET_KEY }}
password: ${{ secrets.MINISIGN_PASSWORD }}
- name: Add public key to release assets
run: cp release/ghcup-gui-release.pub packages/
- name: Publish tagged release
if: startsWith(github.ref, 'refs/tags/v')
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--verify-tag \
packages/*
- name: Update rolling head release
if: github.ref == 'refs/heads/main'
env:
TAG: ghcup-gui-head
RELEASES: repos/${{ github.repository }}/releases
run: |
drafts() {
gh api "$RELEASES" --jq ".[] | select(.draft and .tag_name == \"$TAG\") | .id"
}
for id in $(drafts); do
gh api -X DELETE "$RELEASES/$id"
done
gh release create "$TAG" \
--draft \
--prerelease \
--title "$TAG" \
--notes "Rolling build of the latest commit on main." \
packages/*
draft_id="$(drafts)"
: "${draft_id:?no draft release found after upload}"
if published_id="$(gh api "$RELEASES/tags/$TAG" --jq .id 2>/dev/null)"; then
gh api -X DELETE "$RELEASES/$published_id"
fi
git tag -f "$TAG"
git push -f origin "$TAG"
gh api -X PATCH "$RELEASES/$draft_id" -F draft=false