diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0330efe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: Build and Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + cabal: + strategy: + matrix: + ghc: ['8.10.7','9.0.2','9.2.8','9.4.8','9.6.7','9.8.4','9.10.2','9.12.2'] + runs-on: [windows-latest, macos-latest, ubuntu-latest] + exclude: + - runs-on: macos-latest # requires llvm@13 but it's disabled in homebrew + ghc: '8.10.7' + - runs-on: macos-latest # requires llvm@13 but it's disabled in homebrew + ghc: '9.0.2' + fail-fast: false + name: Cabal - ${{ matrix.runs-on }} GHC ${{ matrix.ghc }} + runs-on: ${{ matrix.runs-on }} + steps: + - uses: actions/checkout@v5 + - uses: haskell-actions/setup@v2 + with: + ghc-version: ${{ matrix.ghc }} + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cabal + dist-newstyle + key: ${{ matrix.runs-on }}-cabal-${{ matrix.ghc }}-${{ hashFiles('streaming-commons.cabal') }} + restore-keys: | + ${{ matrix.runs-on }}-cabal-${{ matrix.ghc }} + ${{ matrix.runs-on }}-cabal- + + - name: Update Cabal package list + run: cabal v2-update --with-compiler=ghc-${{ matrix.ghc }} + + - name: Build project + run: cabal v2-build --with-compiler=ghc-${{ matrix.ghc }} + + - name: Run tests + run: cabal v2-test --with-compiler=ghc-${{ matrix.ghc }} + + stack: + strategy: + matrix: + resolver: ['lts-18','lts-19','lts-20','lts-21','lts-22', 'lts-23', 'lts-24','nightly'] + runs-on: [windows-latest, macos-latest, ubuntu-latest] + exclude: + - runs-on: macos-latest # requires llvm@13 but it's disabled in homebrew + resolver: 'lts-18' + - runs-on: macos-latest # requires llvm@13 but it's disabled in homebrew + resolver: 'lts-19' + fail-fast: false + name: Stack - ${{ matrix.runs-on }} Resolver ${{ matrix.resolver }} + runs-on: ${{ matrix.runs-on }} + steps: + - uses: actions/checkout@v5 + - uses: haskell-actions/setup@v2 + with: + enable-stack: true + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.stack + key: ${{ matrix.runs-on }}-stack-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }} + restore-keys: | + ${{ matrix.runs-on }}-stack-${{ matrix.resolver }}- + ${{ matrix.runs-on }}-stack- + + - name: Install dependencies for resolver ${{ matrix.resolver }} + run: stack setup --resolver ${{ matrix.resolver }} + + - name: Build the project with resolver ${{ matrix.resolver }} + run: stack build --resolver ${{ matrix.resolver }} + + - name: Run spec tests with resolver ${{ matrix.resolver }} + run: stack test --resolver ${{ matrix.resolver }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 5d1af64..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Tests - -on: - pull_request: - push: - branches: - - master - -jobs: - build: - name: CI - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - args: - - "--resolver nightly" - - "--resolver lts-17" - - "--resolver lts-16" - - "--resolver lts-14" - # Bugs in GHC make it crash too often to be worth running - exclude: - - os: windows-latest - args: "--resolver nightly" - - os: windows-latest - args: "--resolver lts-16" - - steps: - - name: Clone project - uses: actions/checkout@v2 - -# Getting weird OS X errors... -# - name: Cache dependencies -# uses: actions/cache@v1 -# with: -# path: ~/.stack -# key: ${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }} -# restore-keys: | -# ${{ runner.os }}-${{ matrix.resolver }}- - - - name: Build and run tests - shell: bash - run: | - set -ex - stack upgrade - stack --version - stack test --fast --no-terminal ${{ matrix.args }} diff --git a/README.md b/README.md index 3cad309..7a5aef8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ streaming-commons Common lower-level functions needed by various streaming data libraries. Intended to be shared by libraries like conduit and pipes. -[![Build status](https://github.com/fpco/streaming-commons/actions/workflows/tests.yml/badge.svg)](https://github.com/fpco/streaming-commons/actions/workflows/tests.yml) +[![Build status](https://github.com/fpco/streaming-commons/actions/workflows/ci.yml/badge.svg)](https://github.com/fpco/streaming-commons/actions/workflows/ci.yml) Dependencies ------------