Skip to content

Commit 0c35fe2

Browse files
authored
Merge pull request #113 from haskell/github-actions
Use GitHub Actions for CI
2 parents 7123ff4 + ba9207a commit 0c35fe2

File tree

12 files changed

+220
-368
lines changed

12 files changed

+220
-368
lines changed

.github/workflows/ci.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: CI
2+
on:
3+
# - pull_request
4+
- push
5+
jobs:
6+
build_posix:
7+
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
ghc:
12+
- '8.10.3'
13+
- '8.8.4'
14+
- '8.6.5'
15+
- '8.4.4'
16+
- '8.2.2'
17+
cabal:
18+
- '3.2'
19+
os:
20+
- ubuntu-latest
21+
- macOS-latest
22+
fail-fast: false
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Haskell
26+
id: setup-haskell-cabal
27+
uses: haskell/actions/setup@v1
28+
with:
29+
ghc-version: ${{ matrix.ghc }}
30+
cabal-version: ${{ matrix.cabal }}
31+
- name: Cache cabal-store
32+
uses: actions/cache@v2
33+
with:
34+
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
35+
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
36+
- name: Install system dependencies (Linux)
37+
if: runner.os == 'Linux'
38+
run: sudo apt-get install libgtk2.0-dev
39+
- name: Install system dependencies (macOS)
40+
if: runner.os == 'macOS'
41+
run: brew install gtk+ pkg-config
42+
- name: Set extra cabal build options (macOS)
43+
if: runner.os == 'macOS'
44+
run: echo "CABAL_BUILD_OPTIONS=--constraint='gtk +have-quartz-gtk'" >> $GITHUB_ENV
45+
- name: Build Haskell dependencies
46+
run: |
47+
echo $CABAL_BUILD_OPTIONS
48+
eval cabal build $CABAL_BUILD_OPTIONS --enable-tests --enable-benchmarks --dep -j all
49+
eval cabal build $CABAL_BUILD_OPTIONS --disable-tests --disable-benchmarks --dep -j all
50+
- name: Build ThreadScope
51+
run: |
52+
DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
53+
# Packaging...
54+
cabal v2-sdist all
55+
# Unpacking...
56+
mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
57+
cd ${DISTDIR} || false
58+
find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
59+
find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
60+
PKGDIR_threadscope="$(find . -maxdepth 1 -type d -regex '.*/threadscope-[0-9.]*')"
61+
# Generate cabal.project
62+
rm -rf cabal.project cabal.project.local cabal.project.freeze
63+
touch cabal.project
64+
echo "packages: ${PKGDIR_threadscope}" >> cabal.project
65+
for pkg in $(ghc-pkg list --simple-output); do
66+
echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(threadscope)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local;
67+
done
68+
cat cabal.project || true
69+
cat cabal.project.local || true
70+
# Building...
71+
# this builds all libraries and executables (without tests/benchmarks)
72+
eval cabal build $CABAL_BUILD_OPTIONS --disable-tests --disable-benchmarks all
73+
# Building with tests and benchmarks...
74+
# build & run tests, build benchmarks
75+
eval cabal build $CABAL_BUILD_OPTIONS --enable-tests --enable-benchmarks all
76+
# cabal check...
77+
(cd ${PKGDIR_threadscope} && cabal -vnormal check)
78+
# Building without installed constraints for packages in global-db...
79+
rm -f cabal.project.local
80+
eval cabal build $CABAL_BUILD_OPTIONS --disable-tests --disable-benchmarks all
81+
echo $(cabal v2-exec -v0 which threadscope)
82+
cp "$(cabal v2-exec -v0 which threadscope)" "$GITHUB_WORKSPACE/threadscope.$PLATFORM.ghc-$GHCVER"
83+
gzip -f "$GITHUB_WORKSPACE/threadscope.$PLATFORM.ghc-$GHCVER"
84+
env:
85+
GHCVER: ${{ matrix.ghc }}
86+
PLATFORM: ${{ matrix.os }}
87+
- name: Release
88+
uses: softprops/action-gh-release@v1
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.ghc == '8.10.3' }}
92+
with:
93+
files: threadscope.${{ matrix.os }}.ghc-${{ matrix.ghc }}.gz
94+
draft: false
95+
prerelease: false
96+
build_windows:
97+
name: ${{ matrix.os }} / ghc ${{ matrix.ghc }}
98+
runs-on: ${{ matrix.os }}
99+
strategy:
100+
matrix:
101+
ghc:
102+
- '8.10.3'
103+
- '8.8.4'
104+
- '8.6.5'
105+
- '8.4.4'
106+
- '8.2.2'
107+
cabal:
108+
- '3.2'
109+
os:
110+
- windows-latest
111+
fail-fast: false
112+
steps:
113+
- uses: actions/checkout@v2
114+
- name: Set up Haskell
115+
id: setup-haskell-cabal
116+
uses: haskell/actions/setup@v1
117+
with:
118+
ghc-version: ${{ matrix.ghc }}
119+
cabal-version: ${{ matrix.cabal }}
120+
- name: Install system dependencies
121+
uses: msys2/setup-msys2@v2
122+
with:
123+
path-type: inherit
124+
install: >-
125+
mingw-w64-x86_64-pkg-config
126+
mingw-w64-x86_64-gtk2
127+
- name: Cache cabal-store
128+
uses: actions/cache@v2
129+
with:
130+
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
131+
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
132+
- name: Build Haskell dependencies
133+
run: cabal build -j all --dep
134+
shell: msys2 {0}
135+
- name: Build ThreadScope
136+
run: |
137+
cabal build -j all
138+
cp -v $(find -name threadscope.exe) ./threadscope.exe
139+
7z a threadscope.$PLATFORM.ghc-$GHCVER.zip threadscope.exe
140+
shell: msys2 {0}
141+
env:
142+
PLATFORM: ${{ matrix.os }}
143+
GHCVER: ${{ matrix.ghc }}
144+
- name: Release
145+
uses: softprops/action-gh-release@v1
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.ghc == '8.10.3' }}
149+
with:
150+
files: threadscope.${{ matrix.os }}.ghc-${{ matrix.ghc }}.zip
151+
draft: false
152+
prerelease: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist-newstyle
2+
cabal.project.local~*

.travis.yml

Lines changed: 0 additions & 171 deletions
This file was deleted.

.travis/deploy.patch

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)