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

Deprecation warning for setup action #628

Deprecation warning for setup action

Deprecation warning for setup action #628

Workflow file for this run

name: "/setup"
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:
defaults:
run:
shell: bash
working-directory: setup
jobs:
test:
name: Unit Tests - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
cache-dependency-path: setup/package-lock.json
- run: npm ci --prefer-offline --no-audit --progress=false
- run: npm run bundle
- run: npm test
install-haskell:
name: GHC ${{ matrix.plan.ghc }}, Cabal ${{ matrix.plan.cabal }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
# Let's see how the other installs are doing and not fail on the first
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
plan:
# Latest releases
- ghc: latest
cabal: latest
# Recommended releases (update according to ghcup)
# 9.4 will be recommended soon
- ghc: "9.4"
cabal: "3.8"
- ghc: "9.2"
cabal: "3.6"
# Some previously recommended releases of ghc with matching cabal
- ghc: "8.10"
cabal: "3.2"
- ghc: "8.8"
cabal: "3.0"
# cabal-3.0 install might have the Windows symlinking problem
# https://github.com/haskell/cabal/issues/5748
- ghc: "8.6"
cabal: "2.4"
cabal_update: ["false"]
# The following tests do not set 'cabal-update', which defaults to 'true' then.
include:
# Test #210 (XDG): is the cabal store-dir set to something meaningful?
- os: ubuntu-latest
plan:
ghc: "9.6"
cabal: "3.10"
cabal_update: "true"
# With choco, cabal 3.10.1.0 should map to 3.10.1.1
- os: windows-latest
plan:
ghc: "9.6"
cabal: "3.10"
cabal_update: "true"
# Test some old versions
- os: ubuntu-latest
plan:
ghc: "8.2.2"
cabal: "2.4.1.0"
cabal_update: "false"
- os: ubuntu-20.04
plan:
ghc: "7.4.2"
cabal: "3.4"
# ubuntu-20.04/hvr has of GHC 7 just 7.0.1, 7.0.4, 7.2.2, 7.4.2, 7.10.3
# and of cabal just 2.4, 3.0, 3.2, 3.4
# according to https://launchpad.net/~hvr/+archive/ubuntu/ghc?field.series_filter=focal
# Test ghcup pre-release channel
- os: ubuntu-latest
ghcup_release_channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml"
plan:
ghc: "9.6.0.20230111"
cabal: "3.8"
# Test ghc nightly
- os: ubuntu-latest
ghcup_release_channel: "https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml"
plan:
ghc: "latest-nightly"
cabal: "latest"
# setup does something special for 7.10.3 (issue #79)
- os: ubuntu-20.04
plan:
ghc: "7.10.3"
cabal: "3.6"
- os: macOS-latest
plan:
ghc: "7.10.3"
cabal: "3.4"
# Andreas 2022-12-29, issue #98: GHC 7.10 failed to install on windows (choco)
- os: windows-latest
plan:
ghc: "7.10"
cabal: "3.0"
# Test for issue #129: GHC 9.4.3 failed to install on windows (choco)
- os: windows-latest
plan:
ghc: "9.4.3"
cabal: "3.8.1.0"
# Test ghcup on windows (PR #206) which choco does not have 9.4.5
- os: windows-latest
plan:
ghc: "9.4.5"
cabal: "3.8"
# Test GHC 9.4.4 on windows (Issue #245)
- os: windows-latest
plan:
ghc: "9.4.4"
cabal: "3.10.1.0"
steps:
- uses: actions/checkout@v3
- uses: ./setup
id: setup
with:
ghc-version: ${{ matrix.plan.ghc }}
ghcup-release-channel: ${{ matrix.ghcup_release_channel }}
cabal-version: ${{ matrix.plan.cabal }}
cabal-update: ${{ matrix.cabal_update }}
- name: Show installed versions and PATH
run: |
cabal --version
ghc --version
echo "$PATH"
- name: Confirm resolved and installed versions match
shell: bash
run: |
CABALVER="$(cabal --numeric-version)"
GHCVER="$(ghc --numeric-version)"
echo "CABALVER=${CABALVER}" >> "${GITHUB_ENV}"
echo "GHCVER=${GHCVER}" >> "${GITHUB_ENV}"
if [[ "${{ steps.setup.outputs.ghc-version }}" == "latest-nightly" ]]
then
GHCVER_EXPECTED=$( \
curl "${{ matrix.ghcup_release_channel }}" | \
yq '.ghcupDownloads.GHC[] | select(.viTags[] | contains("LatestNightly")) | key' \
)
echo "Latest nightly: ${GHCVER_EXPECTED}"
else
GHCVER_EXPECTED="${{ steps.setup.outputs.ghc-version }}"
fi
[[ "${CABALVER}" == "${{ steps.setup.outputs.cabal-version }}" ]] && \
[[ "${GHCVER}" == "${GHCVER_EXPECTED}" ]]
- name: Test runghc
run: |
runghc --version
runghc __tests__/hello.hs
- name: Build test project
working-directory: setup/__tests__/project
run: cabal build
- name: Run test project
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: Confirm installed and expected versions match
shell: bash
# check that if given in the matrix, the actual version matches:
# - cabal: major version
# - ghc: major and minor version
# pure bash startsWith
run: |
if [[ "${{ matrix.plan.cabal }}" =~ ^([0-9]+\.[0-9]+) ]]; then cabalmajor="${BASH_REMATCH[1]}"; fi
if [[ "${{ matrix.plan.ghc }}" =~ ^([0-9]+\.[0-9]+) ]]; then ghcmajor="${BASH_REMATCH[1]}"; fi
if [[ "${{ matrix.plan.ghc }}" =~ ^([0-9]+\.[0-9]+\.[0-9]+) ]]; then ghcver="${BASH_REMATCH[1]}"; fi
[[ "${CABALVER}" =~ ^"${cabalmajor}" ]] && [[ "${GHCVER}" =~ ^"${ghcmajor}" ]] && [[ "${GHCVER}" =~ ^"${ghcver}" ]]
test-fallback:
name: Test GHC Installation Fallbacks - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: ./setup
id: setup
env:
RUNNER_DEBUG: "1"
with:
ghc-version: 8.21.5
- name: Error on success
if: steps.setup.outputs.failed != 'true'
# NB: 'failed' is an undeclared output of the setup action, used in debug mode
run: |
echo "Error: ghc 8.21.5 didn't fail to install"
install-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", "2.3.3"]
steps:
- uses: actions/checkout@v3
- uses: ./setup
id: setup
with:
enable-stack: true
stack-no-global: true
stack-version: ${{ matrix.stack }}
- run: |
stack --version
stack --help
- name: Checking if returned stack-root output is correct
shell: bash
# NB: we invoke `stack path` twice, because the first time it
# might install things (like MSYS2 on Windows) which clobber the output.
run: |
stack path --system-ghc
expected_stack_root=$(stack path --system-ghc --stack-root)
if [ "${expected_stack_root}" != "${{ steps.setup.outputs.stack-root }}" ]; then
echo "Stack-root does not match expected value"
echo "Expected stack-root: ${expected_stack_root}"
echo "Returned stack-root: ${{ steps.setup.outputs.stack-root }}"
exit 1
fi