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

Commit

Permalink
Add suport for GHC nightlies via GHCup (#279)
Browse files Browse the repository at this point in the history
This is supported since GHCup 0.1.19.3. See:
https://www.haskell.org/ghcup/guide/#nightlies
  • Loading branch information
wismill authored Aug 8, 2023
1 parent 25533b9 commit 3501ebb
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ jobs:
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:
Expand Down Expand Up @@ -159,8 +166,18 @@ jobs:
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}" == "${{ steps.setup.outputs.ghc-version }}" ]]
[[ "${GHCVER}" == "${GHCVER_EXPECTED}" ]]
- name: Test runghc
run: |
Expand Down
5 changes: 4 additions & 1 deletion setup/dist/index.js

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

5 changes: 4 additions & 1 deletion setup/lib/installer.js

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

9 changes: 7 additions & 2 deletions setup/src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {ghcup_version, OS, Tool, releaseRevision} from './opts';
import process from 'process';
import * as glob from '@actions/glob';
import * as fs from 'fs';
import {compareVersions} from 'compare-versions'; // compareVersions can be used in the sense of >
import {compareVersions, validate} from 'compare-versions'; // compareVersions can be used in the sense of >

// Don't throw on non-zero.
const exec = async (cmd: string, args?: string[]): Promise<number> =>
Expand Down Expand Up @@ -171,7 +171,12 @@ export async function installTool(
await ghcupGHCHead();
break;
}
if (tool === 'ghc' && compareVersions('8.3', version)) {
// “version” may not be a semantic version (e.g. “latest-nightly”),
// so guard “compareVersions” with “validate”.
if (
tool === 'ghc' &&
(!validate(version) || compareVersions('8.3', version))
) {
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
// Atm, I do not know how to check whether we are on ubuntu-20.04.
// So, ignore the error.
Expand Down

0 comments on commit 3501ebb

Please sign in to comment.