Skip to content

Commit

Permalink
Update CI to use GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sheaf committed Apr 5, 2024
1 parent 1c17566 commit 773934a
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 55 deletions.
116 changes: 84 additions & 32 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,99 @@ name: Tests
on:
pull_request:
push:
branches:
- master
branches:
- '**'

jobs:
build:
name: CI
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
args:
- "--resolver ghc-9.8.1"
- "--resolver ghc-9.6.3"
- "--resolver ghc-9.4.7"
- "--resolver ghc-9.2.8"
- "--resolver ghc-9.0.1"
- "--resolver ghc-8.10.4"
- "--resolver ghc-8.8.4"
- "--resolver ghc-8.6.5"
- "--resolver ghc-8.4.4"
- "--resolver ghc-8.2.2"
ghc-version:
- '9.8'
- '9.6'
- '9.4'
- '9.2'
- '9.0'
- '8.10'
- '8.8'
- '8.6'
- '8.4'
- '8.2'

steps:
- name: Clone project
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Build and run tests
shell: bash
- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}
# Defaults, added for clarity:
cabal-version: 'latest'
cabal-update: true

- name: Configure the build
run: |
set -ex
stack upgrade
stack --version
if [[ "${{ runner.os }}" = 'Windows' ]]
then
# Looks like a bug in Stack, this shouldn't break things
ls C:/ProgramData/Chocolatey/bin/
rm -rf C:/ProgramData/Chocolatey/bin/ghc*
stack ${{ matrix.args }} exec pacman -- --sync --refresh --noconfirm autoconf
fi
stack build
stack sdist --test-tarball
cd test
stack test --bench --no-run-benchmarks --haddock --no-terminal ${{ matrix.args }}
if [[ "${{ matrix.os }}" = "Windows" ]];
then
pacman -S --needed --noconfirm autoconf automake
fi
autoreconf -i
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build all --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.

- name: Restore cached dependencies
uses: actions/cache/restore@v3
id: cache
env:
key: ${{ runner.os }}-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@v3
# 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 process
- name: Source dist
run: |
cabal sdist all --ignore-project
# On Windows and with GHC >= 9.0, re-run the test-suite using WinIO.
- name: Run tests
run: |
cabal run process-tests:test
if (( "${{ matrix.os }}" = "Windows" && ${{ matrix.ghc-version }} >= "9.0" ));
then
cabal run process-tests:test -- +RTS --io-manager=native -RTS
fi
- name: Build documentation
run: cabal haddock process

- name: Check process.cabal
run: cabal check

- name: Check process-tests.cabal
working-directory: ./test
run: cabal check
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/.cabal-sandbox/
/cabal.project.local
/cabal.sandbox.config
/dist/
/dist-newstyle/
/.stack-work/
**/.cabal-sandbox/
**/cabal.project.local
**/cabal.sandbox.config
**/dist/
**/dist-newstyle/
**/.stack-work/
*.swp
stack.yaml.lock

# Specific generated files
GNUmakefile
Expand Down
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: ., test
6 changes: 4 additions & 2 deletions process.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ description:
read more about it at
<https://github.com/fpco/typed-process/#readme>.

extra-doc-files:
changelog.md

extra-source-files:
aclocal.m4
changelog.md
configure
configure.ac
include/HsProcessConfig.h.in
Expand Down Expand Up @@ -85,7 +87,7 @@ library
runProcess.h
processFlags.h

ghc-options: -Wall -rtsopts
ghc-options: -Wall

build-depends: base >= 4.10 && < 4.20,
directory >= 1.1 && < 1.4,
Expand Down
11 changes: 11 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
resolver: ghc-9.2.3

packages:
- .
- test

extra-deps:
- Cabal-3.6.3.0

allow-newer: True
allow-newer-deps:
- Cabal
31 changes: 31 additions & 0 deletions test/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Copyright (c) 2024, the Haskell process developers.

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Isaac Jones nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 changes: 8 additions & 6 deletions test/process-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cabal-version: 2.4
name: process-tests
version: 1.6.19.0
license: BSD-3-Clause
license-file: ../LICENSE
license-file: LICENSE
maintainer: libraries@haskell.org
bug-reports: https://github.com/haskell/process/issues
synopsis: Testing package for the process library
Expand All @@ -16,6 +16,10 @@ source-repository head
location: https://github.com/haskell/process.git
subdir: tests

common process-dep
build-depends:
process == 1.6.19.0

custom-setup
setup-depends:
base >= 4.10 && < 4.20,
Expand All @@ -25,27 +29,25 @@ custom-setup

-- Test executable for the CommunicationHandle functionality
executable cli-child
import: process-dep
default-language: Haskell2010
hs-source-dirs: cli-child
main-is: main.hs
build-depends: base >= 4 && < 5
, deepseq
, process
, deepseq >= 1.1 && < 1.6
ghc-options: -threaded -rtsopts

test-suite test
import: process-dep
default-language: Haskell2010
hs-source-dirs: .
main-is: main.hs
type: exitcode-stdio-1.0
-- Add otherwise redundant bounds on base since GHC's build system runs
-- `cabal check`, which mandates bounds on base.
build-depends: base >= 4 && < 5
, bytestring
, deepseq
, directory
, filepath
, process == 1.6.19.0
build-tool-depends: process-tests:cli-child
ghc-options: -threaded -rtsopts -with-rtsopts "-N"
other-modules: Test.Paths
Expand Down
9 changes: 0 additions & 9 deletions test/stack.yaml

This file was deleted.

0 comments on commit 773934a

Please sign in to comment.