Allow to set arbitrary tools in bindist action

Fixes #35
This commit is contained in:
Julian Ospald 2022-09-15 22:25:22 +08:00
parent fd71594ee6
commit 3f891cc56a
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
2 changed files with 25 additions and 10 deletions

View File

@ -5,8 +5,12 @@ defaults:
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
ghcVersion: tool:
description: GHC version description: Tool
required: true
type: string
version:
description: Version
required: true required: true
type: string type: string
metadataFile: metadataFile:
@ -18,7 +22,8 @@ env:
BOOTSTRAP_HASKELL_NONINTERACTIVE: 1 BOOTSTRAP_HASKELL_NONINTERACTIVE: 1
BOOTSTRAP_HASKELL_MINIMAL: 1 BOOTSTRAP_HASKELL_MINIMAL: 1
BOOTSTRAP_HASKELL_ADJUST_BASHRC: 1 BOOTSTRAP_HASKELL_ADJUST_BASHRC: 1
GHC_VERSION: ${{ github.event.inputs.ghcVersion }} TOOL: ${{ github.event.inputs.tool }}
VERSION: ${{ github.event.inputs.version }}
METADATA_FILE: ${{ github.event.inputs.metadataFile }} METADATA_FILE: ${{ github.event.inputs.metadataFile }}
jobs: jobs:
bindist-install: bindist-install:
@ -60,7 +65,7 @@ jobs:
run: | run: |
${{ matrix.installCmd }} curl bash git ${{ matrix.toolRequirements }} ${{ matrix.installCmd }} curl bash git ${{ matrix.toolRequirements }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install ghcup and bindist for GHC ${{ github.event.inputs.ghcVersion }} - name: Install ghcup and bindist for ${{ github.event.inputs.tool }} ${{ github.event.inputs.version }}
run: .github/workflows/install-bindist.sh run: .github/workflows/install-bindist.sh
bindist-install-non-linux: bindist-install-non-linux:
name: ${{ matrix.os }} name: ${{ matrix.os }}
@ -74,5 +79,5 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install ghcup and bindist for GHC ${{ github.event.inputs.ghcVersion }} - name: Install ghcup and bindist for ${{ github.event.inputs.tool }} ${{ github.event.inputs.version }}
run: .github/workflows/install-bindist.sh run: .github/workflows/install-bindist.sh

View File

@ -10,9 +10,19 @@ source $GHCUP_INSTALL_BASE_PREFIX/.ghcup/env || source ~/.bashrc
ghcup --version ghcup --version
which ghcup | grep foobarbaz which ghcup | grep foobarbaz
ghcup -v --url-source=file:$METADATA_FILE install ghc --set $GHC_VERSION ghcup -v --url-source=file:$METADATA_FILE install $TOOL --set $VERSION
ghc --version case $TOOL in
echo 'main = print $ 1 + 1' > main.hs hls)
ghc main.hs haskell-language-server-wrapper --version
[[ $(./main) -eq 2 ]] ;;
ghc)
ghc --version
echo 'main = print $ 1 + 1' > main.hs
ghc main.hs
[[ $(./main) -eq 2 ]]
;;
*)
$TOOL --version
;;
esac