Consolidate and isolate bindist installation

In particular, this now ensure that we actually use the ghcup version we
installed as well as a separate installation directory, instead of any
potentially previously installed versions/files.
This commit is contained in:
amesgen 2022-08-11 03:27:55 +02:00
parent 0c0736526a
commit 0bdb62c58e
No known key found for this signature in database
GPG Key ID: 1A89EC203635A13D
2 changed files with 30 additions and 40 deletions

View File

@ -14,6 +14,12 @@ on:
required: true
default: ghcup-0.0.7.yaml
type: string
env:
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
BOOTSTRAP_HASKELL_MINIMAL: 1
BOOTSTRAP_HASKELL_ADJUST_BASHRC: 1
GHC_VERSION: ${{ github.event.inputs.ghcVersion }}
METADATA_FILE: ${{ github.event.inputs.metadataFile }}
jobs:
bindist-install:
name: linux-${{ matrix.image }}
@ -42,10 +48,10 @@ jobs:
toolRequirements: build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
- image: archlinux:latest
installCmd: pacman -Syu --noconfirm
toolRequirements: gcc gmp libffi make ncurses perl tar xz
toolRequirements: which gcc gmp libffi make ncurses perl tar xz
- image: fedora:latest
installCmd: dnf install -y
toolRequirements: gcc g++ gmp gmp-devel make ncurses ncurses-compat-libs xz perl
toolRequirements: which gcc g++ gmp gmp-devel make ncurses ncurses-compat-libs xz perl
container:
image: ${{ matrix.image }}
steps:
@ -54,25 +60,8 @@ jobs:
run: |
${{ matrix.installCmd }} curl bash git ${{ matrix.toolRequirements }}
- uses: actions/checkout@v3
- name: Install ghcup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
echo ~/.ghcup/bin >> $GITHUB_PATH
env:
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
BOOTSTRAP_HASKELL_MINIMAL: 1
- name: Print tool requirements
run: ghcup tool-requirements
- name: Install GHC ${{ github.event.inputs.ghcVersion }}
run: |
ghcup -v --url-source=file:${{ github.event.inputs.metadataFile }} \
install ghc --set ${{ github.event.inputs.ghcVersion }}
- name: GHC sanity check
run: |
ghc --version
echo 'main = print $ 1 + 1' > main.hs
ghc main.hs
[[ $(./main) -eq 2 ]]
- name: Install ghcup and bindist for GHC ${{ github.event.inputs.ghcVersion }}
run: .github/workflows/install-bindist.sh
bindist-install-non-linux:
name: ${{ matrix.os }}
strategy:
@ -85,22 +74,5 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install ghcup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
echo ~/.ghcup/bin >> $GITHUB_PATH
env:
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
BOOTSTRAP_HASKELL_MINIMAL: 1
- name: Print tool requirements
run: ghcup tool-requirements
- name: Install GHC ${{ github.event.inputs.ghcVersion }}
run: |
ghcup -v --url-source=file:${{ github.event.inputs.metadataFile }} \
install ghc --set ${{ github.event.inputs.ghcVersion }}
- name: GHC sanity check
run: |
ghc --version
echo 'main = print $ 1 + 1' > main.hs
ghc main.hs
[[ $(./main) -eq 2 ]]
- name: Install ghcup and bindist for GHC ${{ github.event.inputs.ghcVersion }}
run: .github/workflows/install-bindist.sh

18
.github/workflows/install-bindist.sh vendored Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eo pipefail
export GHCUP_INSTALL_BASE_PREFIX=$RUNNER_TEMP/foobarbaz
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env || source ~/.bashrc
ghcup --version
which ghcup | grep foobarbaz
ghcup -v --url-source=file:$METADATA_FILE install ghc --set $GHC_VERSION
ghc --version
echo 'main = print $ 1 + 1' > main.hs
ghc main.hs
[[ $(./main) -eq 2 ]]