Skip to content

Commit efccb54

Browse files
committed
Update CI to use GitHub Actions
1 parent 1c17566 commit efccb54

File tree

8 files changed

+142
-55
lines changed

8 files changed

+142
-55
lines changed

.github/workflows/tests.yml

Lines changed: 80 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,95 @@ name: Tests
33
on:
44
pull_request:
55
push:
6-
branches:
7-
- master
6+
branches:
7+
- '**'
88

99
jobs:
1010
build:
11-
name: CI
11+
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, macos-latest, windows-latest]
17-
args:
18-
- "--resolver ghc-9.8.1"
19-
- "--resolver ghc-9.6.3"
20-
- "--resolver ghc-9.4.7"
21-
- "--resolver ghc-9.2.8"
22-
- "--resolver ghc-9.0.1"
23-
- "--resolver ghc-8.10.4"
24-
- "--resolver ghc-8.8.4"
25-
- "--resolver ghc-8.6.5"
26-
- "--resolver ghc-8.4.4"
27-
- "--resolver ghc-8.2.2"
17+
ghc-version:
18+
- '9.8'
19+
- '9.6'
20+
- '9.4'
21+
- '9.2'
22+
- '9.0'
23+
- '8.10'
24+
- '8.8'
25+
- '8.6'
26+
- '8.4'
27+
- '8.2'
2828

2929
steps:
30-
- name: Clone project
31-
uses: actions/checkout@v4
30+
- uses: actions/checkout@v4
3231

33-
- name: Build and run tests
34-
shell: bash
32+
- name: Set up GHC ${{ matrix.ghc-version }}
33+
uses: haskell-actions/setup@v2
34+
id: setup
35+
with:
36+
ghc-version: ${{ matrix.ghc-version }}
37+
# Defaults, added for clarity:
38+
cabal-version: 'latest'
39+
cabal-update: true
40+
41+
- name: Configure the build
3542
run: |
36-
set -ex
37-
stack upgrade
38-
stack --version
39-
if [[ "${{ runner.os }}" = 'Windows' ]]
40-
then
41-
# Looks like a bug in Stack, this shouldn't break things
42-
ls C:/ProgramData/Chocolatey/bin/
43-
rm -rf C:/ProgramData/Chocolatey/bin/ghc*
44-
stack ${{ matrix.args }} exec pacman -- --sync --refresh --noconfirm autoconf
45-
fi
46-
stack build
47-
stack sdist --test-tarball
48-
cd test
49-
stack test --bench --no-run-benchmarks --haddock --no-terminal ${{ matrix.args }}
43+
autoreconf -i
44+
cabal configure --enable-tests --enable-benchmarks --disable-documentation
45+
cabal build all --dry-run
46+
# The last step generates dist-newstyle/cache/plan.json for the cache key.
47+
48+
- name: Restore cached dependencies
49+
uses: actions/cache/restore@v3
50+
id: cache
51+
env:
52+
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
53+
with:
54+
path: ${{ steps.setup.outputs.cabal-store }}
55+
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
56+
restore-keys: ${{ env.key }}-
57+
58+
- name: Install dependencies
59+
# If we had an exact cache hit, the dependencies will be up to date.
60+
if: steps.cache.outputs.cache-hit != 'true'
61+
run: cabal build all --only-dependencies
62+
63+
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
64+
- name: Save cached dependencies
65+
uses: actions/cache/save@v3
66+
# If we had an exact cache hit, trying to save the cache would error because of key clash.
67+
if: steps.cache.outputs.cache-hit != 'true'
68+
with:
69+
path: ${{ steps.setup.outputs.cabal-store }}
70+
key: ${{ steps.cache.outputs.cache-primary-key }}
71+
72+
- name: Build
73+
run: |
74+
cabal build process
75+
76+
- name: Source dist
77+
run: |
78+
cabal sdist all --ignore-project
79+
80+
# On Windows and with GHC >= 9.0, re-run the test-suite using WinIO.
81+
- name: Run tests
82+
run: |
83+
cabal run process-tests:test
84+
if (( "${{ matrix.os }}" = "Windows" && ${{ matrix.ghc-version }} >= "9.0" ));
85+
then
86+
cabal run process-tests:test -- +RTS --io-manager=native -RTS
87+
fi
88+
89+
- name: Build documentation
90+
run: cabal haddock process
91+
92+
- name: Check process.cabal
93+
run: cabal check
94+
95+
- name: Check process-tests.cabal
96+
working-directory: ./test
97+
run: cabal check

.gitignore

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
/.cabal-sandbox/
2-
/cabal.project.local
3-
/cabal.sandbox.config
4-
/dist/
5-
/dist-newstyle/
6-
/.stack-work/
1+
**/.cabal-sandbox/
2+
**/cabal.project.local
3+
**/cabal.sandbox.config
4+
**/dist/
5+
**/dist-newstyle/
6+
**/.stack-work/
77
*.swp
8+
stack.yaml.lock
89

910
# Specific generated files
1011
GNUmakefile

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: ., test

process.cabal

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ description:
1818
read more about it at
1919
<https://github.com/fpco/typed-process/#readme>.
2020

21+
extra-doc-files:
22+
changelog.md
23+
2124
extra-source-files:
2225
aclocal.m4
23-
changelog.md
2426
configure
2527
configure.ac
2628
include/HsProcessConfig.h.in
@@ -85,7 +87,7 @@ library
8587
runProcess.h
8688
processFlags.h
8789

88-
ghc-options: -Wall -rtsopts
90+
ghc-options: -Wall
8991

9092
build-depends: base >= 4.10 && < 4.20,
9193
directory >= 1.1 && < 1.4,

stack.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
resolver: ghc-9.2.3
2+
3+
packages:
4+
- .
5+
- test
6+
7+
extra-deps:
8+
- Cabal-3.6.3.0
9+
10+
allow-newer: True
11+
allow-newer-deps:
12+
- Cabal

test/LICENSE

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Copyright (c) 2024, the Haskell process developers.
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are
7+
met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above
13+
copyright notice, this list of conditions and the following
14+
disclaimer in the documentation and/or other materials provided
15+
with the distribution.
16+
17+
* Neither the name of Isaac Jones nor the names of other
18+
contributors may be used to endorse or promote products derived
19+
from this software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

test/process-tests.cabal

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cabal-version: 2.4
22
name: process-tests
33
version: 1.6.19.0
44
license: BSD-3-Clause
5-
license-file: ../LICENSE
5+
license-file: LICENSE
66
maintainer: [email protected]
77
bug-reports: https://github.com/haskell/process/issues
88
synopsis: Testing package for the process library
@@ -16,6 +16,10 @@ source-repository head
1616
location: https://github.com/haskell/process.git
1717
subdir: tests
1818

19+
common process-dep
20+
build-depends:
21+
process == 1.6.19.0
22+
1923
custom-setup
2024
setup-depends:
2125
base >= 4.10 && < 4.20,
@@ -25,27 +29,25 @@ custom-setup
2529

2630
-- Test executable for the CommunicationHandle functionality
2731
executable cli-child
32+
import: process-dep
2833
default-language: Haskell2010
2934
hs-source-dirs: cli-child
3035
main-is: main.hs
3136
build-depends: base >= 4 && < 5
32-
, deepseq
33-
, process
37+
, deepseq >= 1.1 && < 1.6
3438
ghc-options: -threaded -rtsopts
3539

3640
test-suite test
41+
import: process-dep
3742
default-language: Haskell2010
3843
hs-source-dirs: .
3944
main-is: main.hs
4045
type: exitcode-stdio-1.0
41-
-- Add otherwise redundant bounds on base since GHC's build system runs
42-
-- `cabal check`, which mandates bounds on base.
4346
build-depends: base >= 4 && < 5
4447
, bytestring
4548
, deepseq
4649
, directory
4750
, filepath
48-
, process == 1.6.19.0
4951
build-tool-depends: process-tests:cli-child
5052
ghc-options: -threaded -rtsopts -with-rtsopts "-N"
5153
other-modules: Test.Paths

test/stack.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)