Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Fix #130: ensure cabal installdir is in the PATH (#165)
Browse files Browse the repository at this point in the history
Add  `~/.cabal/bin` to the PATH under Linux and macOS.  
Windows' chocolatey install already takes care of this.

That the `installdir` is in the `PATH` is now tested in CI via a `cabal install` with subsequent call to the installed executable.

Original commits:
* CI issue #130: test whether installdir is in the PATH
* Linux/macOS: add ~/.cabal/bin to PATH
* Inform that installdir is added to PATH
  • Loading branch information
andreasabel authored Jan 10, 2023
1 parent 2742846 commit c73a875
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ jobs:
cabal-version: ${{ matrix.cabal }}
cabal-update: ${{ matrix.cabal_update }}

- name: Show installed versions
run: |
cabal --version
ghc --version
- name: Test runghc
run: |
runghc --version
Expand All @@ -91,16 +96,19 @@ jobs:
working-directory: setup/__tests__/project
run: cabal run

- name: Install test project
working-directory: setup/__tests__/project
run: cabal install

- name: Run installed test project
run: hello-haskell-setup
# This tests whether the default installdir has been added to the PATH (issue #130).

- name: Build and run test with Hackage dependency
if: ${{ matrix.cabal_update != 'false' }}
working-directory: setup/__tests__/project-with-hackage-dependency
run: cabal build && cabal run

- name: Show installed versions
run: |
cabal --version
ghc --version
- name: Confirm installed and expected versions match
shell: bash
# check that if given in the matrix, the actual version matches:
Expand Down
2 changes: 1 addition & 1 deletion setup/__tests__/project/project.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: project
version: 0.1.0.0
build-type: Simple

executable project
executable hello-haskell-setup
main-is: Main.hs
build-depends: base
default-language: Haskell2010
4 changes: 4 additions & 0 deletions setup/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions setup/lib/setup-haskell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions setup/src/setup-haskell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export default async function run(
core.setOutput('cabal-store', 'C:\\sr');
} else {
core.setOutput('cabal-store', `${process.env.HOME}/.cabal/store`);
// Issue #130: for non-choco installs, add ~/.cabal/bin to PATH
const installdir = `${process.env.HOME}/.cabal/bin`;
core.info(`Adding ${installdir} to PATH`);
core.addPath(installdir);
}

// Workaround the GHC nopie linking errors for ancient GHC versions
Expand Down

0 comments on commit c73a875

Please sign in to comment.