Skip to content

Commit

Permalink
Add a github workflow to build
Browse files Browse the repository at this point in the history
  • Loading branch information
pranaysashank committed Nov 28, 2023
1 parent 8433f09 commit 07cc955
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 5 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,89 @@
name: build-wxHaskell

on:
push:
pull_request:
branches: [master]

jobs:
build:
strategy:
fail-fast: false
matrix:
ghc: ["9.4.8"]
os: [ ubuntu-latest, macOS-latest ]

runs-on: ${{ matrix.os }}

steps:
- run: git config --global core.autocrlf input
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}

- name: Install wxWidgets on Ubuntu / macOS
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
sudo apt-get install -y libwxgtk3.0-gtk3-dev libwxgtk-media3.0-gtk3-dev
elif [[ "${{ matrix.os }}" == "macOS-latest" ]]; then
brew install wxwidgets
fi
- name: Configure project
run: |
echo "$SHELL"
echo "$PATH"
cabal configure
cabal build all --dry-run
- name: Build
run: |
echo "$SHELL"
echo "$PATH"
cabal build all
build-on-windows:
strategy:
fail-fast: false
matrix:
ghc: ["9.4.8"]
os: [ windows-latest ]

runs-on: ${{ matrix.os }}

steps:
- run: git config --global core.autocrlf input
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}

- name: Install wxWidgets on Windows
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
install: >-
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-wxwidgets3.2-msw
- shell: msys2 {0}
name: Configure project
run: |
export PATH=$PATH:"/c/ghcup/msys64/bin":"/c/ghcup/usr/bin":"/c/ghcup/bin"
echo "$SHELL"
echo "$PATH"
cabal configure
cabal build all --dry-run
- shell: msys2 {0}
name: Build
run: |
export PATH=$PATH:"/c/ghcup/msys64/bin":"/c/ghcup/usr/bin":"/c/ghcup/bin"
echo "$SHELL"
echo "$PATH"
cabal build all
10 changes: 5 additions & 5 deletions wxc/Setup.hs
Expand Up @@ -320,8 +320,8 @@ bitnessMismatch =

getDynamicLibraryName :: FilePath -> IO (Maybe String)
getDynamicLibraryName path =
listToMaybe . filter isLibrary <$> getDirectoryContents path
`E.onException` return Nothing
(listToMaybe . filter isLibrary <$> getDirectoryContents path)
`E.catch` (\(_::E.SomeException) -> return Nothing)
where
isLibrary x = any (`isPrefixOf` x) ["libwx_base", "wxbase"] &&
any (`isInfixOf` x) [".dll", ".dylib", ".so."]
Expand All @@ -330,7 +330,7 @@ bitnessMismatch =
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- A list of wxWidgets versions that can be handled by this version of wxHaskell
wxCompatibleVersions = ["3.2"] -- Preferred version first
wxCompatibleVersions = ["3.2", "3.0"] -- Preferred version first

checkWxVersion :: IO String
checkWxVersion =
Expand All @@ -356,7 +356,7 @@ readWxConfig wxVersion =
#if defined(freebsd_HOST_OS) || defined (netbsd_HOST_OS)
putStrLn "defined(freebsd_HOST_OS) || defined (netbsd_HOST_OS)"
-- find GL/glx.h on non-Linux systems
let glIncludeDirs = readProcess "pkg-config" ["--cflags", "gl"] "" `E.onException` return ""
let glIncludeDirs = readProcess "pkg-config" ["--cflags", "gl"] "" `E.catch` (\(_::E.SomeException) -> return "")
#else
let glIncludeDirs = return ""
#endif
Expand All @@ -380,7 +380,7 @@ readWxConfig wxVersion =
wx_config :: [String] -> IO String
wx_config parms = do
let runExecutable failureAction =
readProcess "wx-config" parms "" `E.onException` failureAction
readProcess "wx-config" parms "" `E.catch` (\(_::E.SomeException) -> failureAction)

b <- isWindowsMsys
if b
Expand Down

0 comments on commit 07cc955

Please sign in to comment.