Compare commits
11 Commits
drop-monad
...
issue-221
| Author | SHA1 | Date | |
|---|---|---|---|
|
283f2a6e46
|
|||
|
94637dfbab
|
|||
|
3e26d7057c
|
|||
|
3f710112f3
|
|||
|
34df41b44a
|
|||
|
3897434ef0
|
|||
|
375dba9dd1
|
|||
|
2edd1fb583
|
|||
|
11326060fb
|
|||
|
d343c01737
|
|||
|
3925f78721
|
@@ -14,7 +14,7 @@ variables:
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
.debian:
|
.debian:
|
||||||
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
|
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
|
||||||
tags:
|
tags:
|
||||||
- x86_64-linux
|
- x86_64-linux
|
||||||
variables:
|
variables:
|
||||||
@@ -527,15 +527,9 @@ release:windows:
|
|||||||
hlint:
|
hlint:
|
||||||
stage: hlint
|
stage: hlint
|
||||||
extends:
|
extends:
|
||||||
- .alpine:64bit
|
- .debian
|
||||||
before_script:
|
|
||||||
- ./.gitlab/before_script/linux/alpine/install_deps.sh
|
|
||||||
script:
|
script:
|
||||||
- ./.gitlab/script/hlint.sh
|
- curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s -- -r lib/ test/
|
||||||
variables:
|
|
||||||
GHC_VERSION: "8.10.6"
|
|
||||||
CABAL_VERSION: "3.4.0.0"
|
|
||||||
JSON_VERSION: "0.0.4"
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 2 week
|
expire_in: 2 week
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
121
README.md
121
README.md
@@ -24,6 +24,7 @@ Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [p
|
|||||||
* [Env variables](#env-variables)
|
* [Env variables](#env-variables)
|
||||||
* [Installing custom bindists](#installing-custom-bindists)
|
* [Installing custom bindists](#installing-custom-bindists)
|
||||||
* [Isolated Installs](#isolated-installs)
|
* [Isolated Installs](#isolated-installs)
|
||||||
|
* [CI](#ci)
|
||||||
* [Tips and tricks](#tips-and-tricks)
|
* [Tips and tricks](#tips-and-tricks)
|
||||||
* [Design goals](#design-goals)
|
* [Design goals](#design-goals)
|
||||||
* [How](#how)
|
* [How](#how)
|
||||||
@@ -190,6 +191,126 @@ Examples:-
|
|||||||
5. you can even compile ghc to an isolated location.
|
5. you can even compile ghc to an isolated location.
|
||||||
- `ghcup compile ghc -j 4 -v 9.0.1 -b 8.10.5 -i /home/username/my/dir/ghc`
|
- `ghcup compile ghc -j 4 -v 9.0.1 -b 8.10.5 -i /home/username/my/dir/ghc`
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### CI
|
||||||
|
|
||||||
|
On windows, ghcup can be installed automatically on a CI runner like so:
|
||||||
|
|
||||||
|
```ps
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false,$true,$true,$false,$false,$false,$false,"C:\"
|
||||||
|
```
|
||||||
|
|
||||||
|
On linux/darwin/freebsd, run the following on your runner:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This will just install `ghcup` and on windows additionally `msys2`.
|
||||||
|
|
||||||
|
#### Example github workflow
|
||||||
|
|
||||||
|
On github workflows you can use https://github.com/haskell/actions/
|
||||||
|
|
||||||
|
If you want to install ghcup manually though, here's an example config:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
name: Haskell CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-cabal:
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||||
|
ghc: ['8.10.7', '9.0.1']
|
||||||
|
cabal: ['3.4.0.0']
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- if: matrix.os == 'windows-latest'
|
||||||
|
name: Install ghcup on windows
|
||||||
|
run: Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false,$true,$true,$false,$false,$false,$false,"C:\"
|
||||||
|
|
||||||
|
- if: matrix.os != 'windows-latest'
|
||||||
|
name: Install ghcup on non-windows
|
||||||
|
run: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
|
||||||
|
|
||||||
|
- if: matrix.os == 'windows-latest'
|
||||||
|
run: echo "/c/ghcup/bin" >> $GITHUB_PATH
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Install ghc/cabal
|
||||||
|
run: |
|
||||||
|
ghcup install ghc ${{ matrix.ghc }}
|
||||||
|
ghcup install cabal ${{ matrix.cabal }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Update cabal index
|
||||||
|
run: cabal update
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cabal build --enable-tests --enable-benchmarks
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: cabal test
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Run benches
|
||||||
|
run: cabal bench
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
build-stack:
|
||||||
|
name: Stack ${{ matrix.stack }} ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||||
|
stack: ['latest']
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- if: matrix.os == 'windows-latest'
|
||||||
|
name: Install ghcup on windows
|
||||||
|
run: Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false,$true,$true,$false,$false,$false,$false,"C:\"
|
||||||
|
|
||||||
|
- if: matrix.os != 'windows-latest'
|
||||||
|
name: Install ghcup on non-windows
|
||||||
|
run: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
|
||||||
|
|
||||||
|
- if: matrix.os == 'windows-latest'
|
||||||
|
run: echo "/c/ghcup/bin" >> $GITHUB_PATH
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Install stack
|
||||||
|
run: ghcup install stack ${{ matrix.stack }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: stack build
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: stack test
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Run benches
|
||||||
|
run: stack bench
|
||||||
|
shell: bash
|
||||||
|
```
|
||||||
|
|
||||||
### Tips and tricks
|
### Tips and tricks
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,11 @@ data ChangeLogOptions = ChangeLogOptions
|
|||||||
|
|
||||||
|
|
||||||
data WhereisCommand = WhereisTool Tool (Maybe ToolVersion)
|
data WhereisCommand = WhereisTool Tool (Maybe ToolVersion)
|
||||||
|
| WhereisBaseDir
|
||||||
|
| WhereisBinDir
|
||||||
|
| WhereisCacheDir
|
||||||
|
| WhereisLogsDir
|
||||||
|
| WhereisConfDir
|
||||||
|
|
||||||
data WhereisOptions = WhereisOptions {
|
data WhereisOptions = WhereisOptions {
|
||||||
directory :: Bool
|
directory :: Bool
|
||||||
@@ -833,7 +838,8 @@ configP = subparser
|
|||||||
|
|
||||||
whereisP :: Parser WhereisCommand
|
whereisP :: Parser WhereisCommand
|
||||||
whereisP = subparser
|
whereisP = subparser
|
||||||
( command
|
(commandGroup "Tools locations:" <>
|
||||||
|
command
|
||||||
"ghc"
|
"ghc"
|
||||||
(WhereisTool GHC <$> info
|
(WhereisTool GHC <$> info
|
||||||
( optional (toolVersionArgument Nothing (Just GHC)) <**> helper )
|
( optional (toolVersionArgument Nothing (Just GHC)) <**> helper )
|
||||||
@@ -868,6 +874,37 @@ whereisP = subparser
|
|||||||
command
|
command
|
||||||
"ghcup"
|
"ghcup"
|
||||||
(WhereisTool GHCup <$> info ( (pure Nothing) <**> helper ) ( progDesc "Get ghcup location" ))
|
(WhereisTool GHCup <$> info ( (pure Nothing) <**> helper ) ( progDesc "Get ghcup location" ))
|
||||||
|
) <|> subparser ( commandGroup "Directory locations:"
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"basedir"
|
||||||
|
(info (pure WhereisBaseDir <**> helper)
|
||||||
|
( progDesc "Get ghcup base directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"bindir"
|
||||||
|
(info (pure WhereisBinDir <**> helper)
|
||||||
|
( progDesc "Get ghcup binary directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"cachedir"
|
||||||
|
(info (pure WhereisCacheDir <**> helper)
|
||||||
|
( progDesc "Get ghcup cache directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"logsdir"
|
||||||
|
(info (pure WhereisLogsDir <**> helper)
|
||||||
|
( progDesc "Get ghcup logs directory location" )
|
||||||
|
)
|
||||||
|
<>
|
||||||
|
command
|
||||||
|
"confdir"
|
||||||
|
(info (pure WhereisConfDir <**> helper)
|
||||||
|
( progDesc "Get ghcup config directory location" )
|
||||||
|
)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
whereisGHCFooter = [s|Discussion:
|
whereisGHCFooter = [s|Discussion:
|
||||||
@@ -2136,6 +2173,26 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ logError $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 30
|
pure $ ExitFailure 30
|
||||||
|
|
||||||
|
Whereis _ WhereisBaseDir -> do
|
||||||
|
putStr baseDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisBinDir -> do
|
||||||
|
putStr binDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisCacheDir -> do
|
||||||
|
putStr cacheDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisLogsDir -> do
|
||||||
|
putStr logsDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
|
Whereis _ WhereisConfDir -> do
|
||||||
|
putStr confDir
|
||||||
|
pure ExitSuccess
|
||||||
|
|
||||||
Upgrade uOpts force' -> do
|
Upgrade uOpts force' -> do
|
||||||
target <- case uOpts of
|
target <- case uOpts of
|
||||||
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
UpgradeInplace -> Just <$> liftIO getExecutablePath
|
||||||
|
|||||||
@@ -372,6 +372,13 @@ adjust_bashrc() {
|
|||||||
echo "[[ -f ~/.bashrc ]] && source ~/.bashrc # ghcup-env" >> "${HOME}/.bash_profile"
|
echo "[[ -f ~/.bashrc ]] && source ~/.bashrc # ghcup-env" >> "${HOME}/.bash_profile"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
MSYS*|MINGW*)
|
||||||
|
if [ ! -e "${HOME}/.bash_profile" ] ; then
|
||||||
|
echo '# generated by ghcup' > "${HOME}/.bash_profile"
|
||||||
|
echo 'test -f ~/.profile && . ~/.profile' >> "${HOME}/.bash_profile"
|
||||||
|
echo 'test -f ~/.bashrc && . ~/.bashrc' >> "${HOME}/.bash_profile"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
break ;;
|
break ;;
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ elevated command prompt:
|
|||||||
|
|
||||||
if ($GhcupBasePrefixEnv) {
|
if ($GhcupBasePrefixEnv) {
|
||||||
$defaultGhcupBasePrefix = $GhcupBasePrefixEnv
|
$defaultGhcupBasePrefix = $GhcupBasePrefixEnv
|
||||||
} else {
|
} elseif (!($InstallDir)) {
|
||||||
$partitions = Get-CimInstance win32_logicaldisk
|
$partitions = Get-CimInstance win32_logicaldisk
|
||||||
$defaultGhcupBasePrefix = $null
|
$defaultGhcupBasePrefix = $null
|
||||||
foreach ($p in $partitions){
|
foreach ($p in $partitions){
|
||||||
@@ -211,10 +211,10 @@ if ($Silent -and !($InstallDir)) {
|
|||||||
$GhcupBasePrefix = $defaultGhcupBasePrefix
|
$GhcupBasePrefix = $defaultGhcupBasePrefix
|
||||||
} elseif ($InstallDir) {
|
} elseif ($InstallDir) {
|
||||||
if (!(Test-Path -LiteralPath ('{0}' -f $InstallDir) -IsValid)) {
|
if (!(Test-Path -LiteralPath ('{0}' -f $InstallDir) -IsValid)) {
|
||||||
Print-Msg -color Red -msg "Not a valid directory!"
|
Print-Msg -color Red -msg "Not a valid directory! (InstallDir)"
|
||||||
Exit 1
|
Exit 1
|
||||||
} elseif (!(Split-Path -IsAbsolute -Path "$InstallDir")) {
|
} elseif (!(Split-Path -IsAbsolute -Path "$InstallDir")) {
|
||||||
Print-Msg -color Red -msg "Non-absolute Path specified!"
|
Print-Msg -color Red -msg "Non-absolute Path specified! (InstallDir)"
|
||||||
Exit 1
|
Exit 1
|
||||||
} else {
|
} else {
|
||||||
$GhcupBasePrefix = $InstallDir
|
$GhcupBasePrefix = $InstallDir
|
||||||
@@ -245,7 +245,20 @@ $null = [Environment]::SetEnvironmentVariable("GHCUP_INSTALL_BASE_PREFIX", $Ghcu
|
|||||||
|
|
||||||
|
|
||||||
$GhcupDir = ('{0}\ghcup' -f $GhcupBasePrefix)
|
$GhcupDir = ('{0}\ghcup' -f $GhcupBasePrefix)
|
||||||
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
if ($ExistingMsys2Dir) {
|
||||||
|
if (!(Test-Path -LiteralPath ('{0}' -f $ExistingMsys2Dir) -IsValid)) {
|
||||||
|
Print-Msg -color Red -msg "Not a valid directory! (ExistingMsys2Dir)"
|
||||||
|
Exit 1
|
||||||
|
} elseif (!(Split-Path -IsAbsolute -Path "$ExistingMsys2Dir")) {
|
||||||
|
Print-Msg -color Red -msg "Non-absolute Path specified! (ExistingMsys2Dir)"
|
||||||
|
Exit 1
|
||||||
|
} else {
|
||||||
|
$MsysDir = $ExistingMsys2Dir
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
||||||
|
}
|
||||||
|
|
||||||
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
||||||
if (!($BootstrapUrl)) {
|
if (!($BootstrapUrl)) {
|
||||||
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell'
|
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell'
|
||||||
@@ -400,6 +413,7 @@ if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
|||||||
|
|
||||||
Print-Msg -msg 'Setting default home directory...'
|
Print-Msg -msg 'Setting default home directory...'
|
||||||
Exec "$Bash" '-lc' "sed -i -e 's/db_home:.*$/db_home: windows/' /etc/nsswitch.conf"
|
Exec "$Bash" '-lc' "sed -i -e 's/db_home:.*$/db_home: windows/' /etc/nsswitch.conf"
|
||||||
|
|
||||||
} elseif ($msys2Decision -eq 1) {
|
} elseif ($msys2Decision -eq 1) {
|
||||||
Print-Msg -color Yellow -msg 'Skipping MSys2 installation.'
|
Print-Msg -color Yellow -msg 'Skipping MSys2 installation.'
|
||||||
while ($true) {
|
while ($true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user