-
Notifications
You must be signed in to change notification settings - Fork 36
162 lines (162 loc) · 5.88 KB
/
ci.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
name: CI
on:
- pull_request
- push
jobs:
build_posix:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
ghc:
- "9.8.2"
- "9.6.4"
- "9.4.8"
- "9.2.2"
- "9.0.2"
- "8.10.7"
- "8.8.4"
cabal:
- "3.12.1.0"
os:
- ubuntu-latest
include:
- os: macos-latest
ghc: "9.8.2"
cabal: "3.12.1.0"
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Haskell
id: setup-haskell-cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Cache cabal-store
uses: actions/cache@v2
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libgtk2.0-dev
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cairo gtk+ pkg-config
- name: Set extra cabal build options (macOS)
if: runner.os == 'macOS'
run: echo "CABAL_BUILD_OPTIONS=--constraint='gtk +have-quartz-gtk'" >> $GITHUB_ENV
- name: Build Haskell dependencies
run: |
echo $CABAL_BUILD_OPTIONS
eval cabal build $CABAL_BUILD_OPTIONS --enable-tests --enable-benchmarks --dep -j all
eval cabal build $CABAL_BUILD_OPTIONS --disable-tests --disable-benchmarks --dep -j all
- name: Build ThreadScope
run: |
DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
cabal v2-sdist all
# Unpacking...
mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
cd ${DISTDIR} || false
find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
PKGDIR_threadscope="$(find . -maxdepth 1 -type d -regex '.*/threadscope-[0-9.]*')"
# Generate cabal.project
rm -rf cabal.project cabal.project.local cabal.project.freeze
touch cabal.project
echo "packages: ${PKGDIR_threadscope}" >> cabal.project
for pkg in $(ghc-pkg list --simple-output); do
echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(threadscope)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local;
done
cat cabal.project || true
cat cabal.project.local || true
# Building...
# this builds all libraries and executables (without tests/benchmarks)
eval cabal build $CABAL_BUILD_OPTIONS --disable-tests --disable-benchmarks all
# Building with tests and benchmarks...
# build & run tests, build benchmarks
eval cabal build $CABAL_BUILD_OPTIONS --enable-tests --enable-benchmarks all
# cabal check...
(cd ${PKGDIR_threadscope} && cabal -vnormal check)
# Building without installed constraints for packages in global-db...
rm -f cabal.project.local
eval cabal build $CABAL_BUILD_OPTIONS --disable-tests --disable-benchmarks all
echo $(cabal v2-exec -v0 which threadscope)
cp "$(cabal v2-exec -v0 which threadscope)" "$GITHUB_WORKSPACE/threadscope.$PLATFORM.ghc-$GHCVER"
gzip -f "$GITHUB_WORKSPACE/threadscope.$PLATFORM.ghc-$GHCVER"
env:
GHCVER: ${{ matrix.ghc }}
PLATFORM: ${{ matrix.os }}
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.ghc == '9.2.2' }}
with:
files: threadscope.${{ matrix.os }}.ghc-${{ matrix.ghc }}.gz
draft: false
prerelease: false
build_windows:
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
ghc:
- "9.8.2"
- "9.6.4"
- "9.4.8"
- "9.2.2"
- "9.0.2"
- "8.10.7"
- "8.8.4"
cabal:
- "3.10.1.0"
os:
- windows-latest
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Haskell
id: setup-haskell-cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Install system dependencies
uses: msys2/setup-msys2@v2
with:
path-type: inherit
update: true
install: >-
mingw64/mingw-w64-x86_64-pkg-config
mingw64/mingw-w64-x86_64-gobject-introspection
mingw-w64-x86_64-glib2
mingw-w64-x86_64-gtk2
- name: Cache cabal-store
uses: actions/cache@v2
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
- name: Build Haskell dependencies
run: cabal build -j all --dep
shell: msys2 {0}
- name: Build ThreadScope
run: |
cabal build -j all
cp -v $(find -name threadscope.exe) ./threadscope.exe
7z a threadscope.$PLATFORM.ghc-$GHCVER.zip threadscope.exe
shell: msys2 {0}
env:
PLATFORM: ${{ matrix.os }}
GHCVER: ${{ matrix.ghc }}
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.ghc == '9.2.2' }}
with:
files: threadscope.${{ matrix.os }}.ghc-${{ matrix.ghc }}.zip
draft: false
prerelease: false