diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5c3032ba..11a92fff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,47 +3,91 @@ 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: | + 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: | - 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 }} + cabal build process + cabal sdist process + + - name: Run tests + run: | + cabal run process-tests:test + # On Windows and with GHC >= 9.0, re-run the test-suite using WinIO. + 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 diff --git a/.gitignore b/.gitignore index 44073d05..e71f7167 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/cabal.project b/cabal.project new file mode 100644 index 00000000..f99d9fad --- /dev/null +++ b/cabal.project @@ -0,0 +1 @@ +packages: ., test diff --git a/process.cabal b/process.cabal index 8495f304..92bb6c24 100644 --- a/process.cabal +++ b/process.cabal @@ -18,9 +18,11 @@ description: read more about it at . +extra-doc-files: + changelog.md + extra-source-files: aclocal.m4 - changelog.md configure configure.ac include/HsProcessConfig.h.in @@ -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, diff --git a/stack.yaml b/stack.yaml index 25614a89..7eca6c60 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1 +1,12 @@ resolver: ghc-9.2.3 + +packages: + - . + - test + +extra-deps: + - Cabal-3.6.3.0 + +allow-newer: True +allow-newer-deps: + - Cabal diff --git a/test/LICENSE b/test/LICENSE new file mode 100644 index 00000000..5343d729 --- /dev/null +++ b/test/LICENSE @@ -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. diff --git a/test/process-tests.cabal b/test/process-tests.cabal index 351c4d5a..ce6d0ffb 100644 --- a/test/process-tests.cabal +++ b/test/process-tests.cabal @@ -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 @@ -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, @@ -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 diff --git a/test/stack.yaml b/test/stack.yaml deleted file mode 100644 index 76575cc1..00000000 --- a/test/stack.yaml +++ /dev/null @@ -1,9 +0,0 @@ -resolver: ghc-9.2.3 - -extra-deps: - - .. - - Cabal-3.10.2.0 - -allow-newer: True -allow-newer-deps: - - Cabal