Skip to content

Switch to GTK3

Switch to GTK3 #169

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
release:
env:
GHC_FOR_RELEASE: "9.10"
jobs:
build:
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} ${{matrix.container}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc-version: ['9.12', '9.10', '9.8', '9.6', '9.4', '9.2']
container: ['']
include:
# The windows build is currently broken
# See #135
- os: windows-latest
ghc-version: '9.10'
- os: macos-latest
ghc-version: '9.10'
# gtk2hs is broken under apline
# See https://github.com/gtk2hs/gtk2hs/issues/262
#- os: ubuntu-latest
# ghc-version: '9.10'
# container: alpine:3.21
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- name: Install system dependencies (Alpine)
if: ${{ startsWith(matrix.container, 'alpine') }}
shell: sh
run: |
apk add bash curl sudo jq pkgconfig \
zlib-dev zlib-static binutils curl \
gcc g++ gmp-dev libc-dev libffi-dev make \
musl-dev ncurses-dev perl tar xz \
gtk+3.0-dev
- name: Install system dependencies (Ubuntu)
if: runner.os == 'Linux' && !startsWith(matrix.container, 'alpine')
run: sudo apt-get update && sudo apt-get install libgtk-3-dev
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cairo gtk+3 pkg-config
- name: Set extra cabal build options (macOS)
if: runner.os == 'macOS'
run: |
printf 'package gtk\n flags: +have-quartz-gtk' >>cabal.project
- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
# Taken from https://github.com/agda/agda/blob/8210048a50c35d8d6fd0ae7e5edd1699592fda6f/src/github/workflows/cabal.yml#L113C1-L124C85
# See: https://github.com/haskell/text-icu/pull/86
# pacman needs MSYS /usr/bin in PATH, but this breaks the latest cache action.
# - https://github.com/actions/cache/issues/1073
# MSYS' pkg-config needs MSYS /mingw64/bin which we can safely add to the PATH
#
- name: Install system dependencies (Windows)
if: ${{ startsWith(matrix.os, 'windows') }}
shell: pwsh
run: |
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
pacman --noconfirm -S msys2-keyring mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gtk3
echo "C:\msys64\mingw64\bin" | Out-File -FilePath "$env:GITHUB_PATH" -Append
- name: Enable static build (only on alpine)
if: ${{ startsWith(matrix.container, 'alpine') }}
run: |
echo 'executable-static: true' >>cabal.project
echo 'cc-options: -D_Noreturn=' >>cabal.project
- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build all --dry-run
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}${{ matrix.container && '-container-' }}${{matrix.container}}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-
- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build
run: cabal build all
- name: Run tests
run: cabal test all
- name: Check cabal file
run: cabal check
- name: Create bindist
shell: sh
run: |
cabal install --install-method=copy --installdir=dist
BINDIST_NAME="threadscope-ghc-${{matrix.ghc-version}}-${{ matrix.os }}${{ matrix.container && '-' }}${{matrix.container && 'alpine'}}"
echo "BINDIST_NAME=$BINDIST_NAME" >> "$GITHUB_ENV"
tar -czf "$BINDIST_NAME.tar.xz" -C dist threadscope
echo bindist is "$BINDIST_NAME.tar.xz"
- name: Upload bindist to artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.ghc-version == env.GHC_FOR_RELEASE }}
with:
name: ${{ env.BINDIST_NAME }}
path: ${{ env.BINDIST_NAME}}.tar.xz
- name: Release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.ghc-version == env.GHC_FOR_RELEASE }}
with:
files: ${{ env.BINDIST_NAME }}.tar.xz