Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Run Tests (on push and pull request)

on:
pull_request:
branches: ['master']

push:
branches: ['master']

jobs:
generate-matrix:
name: "Generate matrix from cabal file"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/[email protected]
with:
cabal-file: opus.cabal
ubuntu-version: "latest"
macos-version: "latest"
windows-version: "latest"
version: 0.1.7.1
tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Set up Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: "latest"

- name: Install libopus (Linux only)
if: runner.os == 'Linux'
run: sudo apt-get install libopus-dev

- name: Install libopus (macOS only)
if: runner.os == 'macOS'
run: brew install opus

- name: Install libopus (Windows only)
if: runner.os == 'Windows'
shell: pwsh
run: |
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
pacman --noconfirm -S mingw64/mingw-w64-x86_64-opus mingw64/mingw-w64-x86_64-pkg-config

# Add the mingw64 bin directory to the PATH so cabal can find pkg-config & opus
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Update cabal store
run: cabal update

- name: Create a freeze file for the cache
run: cabal freeze --enable-tests

- uses: actions/cache@v4
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-

- name: Run the tests
# Use --enable-tests until https://github.com/haskell/cabal/issues/7883
# is fixed, as otherwise cabal test can sometimes reach a local maxima
# of dependencies that bizarrely doesn't (!) include the test suite.
run: cabal test --enable-tests
13 changes: 4 additions & 9 deletions opus.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description:
system.
.
- On Debian-based systems, you can install it with @sudo apt-get install
libopus0@.
libopus-dev@.
- On MacOS, you can install it with @brew install opus@ using Homebrew.
- On Windows (MinGW-based, e.g. GHCup toolchain), you can install it with
@cabal exec -- pacman -S mingw64/mingw-w64-x86_64-opus@ (for x64).
Expand All @@ -35,7 +35,8 @@ maintainer: Yuto Takano <[email protected]>
copyright: Markus Barenhoff <[email protected]>, Yuto Takano <[email protected]>, Haskell Opus Library Contributors
category: Codec
build-type: Simple
cabal-version: >=1.10
cabal-version: >=1.12
tested-with: GHC ==9.4.8
extra-source-files:
README.md
ChangeLog.md
Expand All @@ -54,13 +55,7 @@ library
Codec.Audio.Opus.Internal.Opus
default-language: Haskell2010
build-tools: hsc2hs
includes:
opus/opus.h
opus/opus_types.h
opus/opus_defines.h
extra-libraries: opus
if !os(windows)
pkgconfig-depends: opus
pkgconfig-depends: opus
ghc-options: -Wall
build-depends: base >= 4.7 && < 5,
exceptions,
Expand Down
2 changes: 1 addition & 1 deletion src/Codec/Audio/Opus/Internal/Opus.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Foreign
import Foreign.C.Types
import Foreign.C.String

#include <opus/opus.h>
#include <opus.h>

newtype ErrorCode = ErrorCode { unErrorCode :: CInt }
deriving (Eq,Show)
Expand Down
Loading