Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support for GHC nightlies (from haskell/actions/setup) #27

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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 @@ -158,8 +165,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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ E.g., `8.10` will be resolved to `8.10.7`, and so will `8`.

**GHC:**

- `latest-nightly` (requires the resp. `ghcup-release-channel`, e.g. `https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml`)
- `latest` (default)
- `9.6.2` `9.6`
- `9.6.1`
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13442,7 +13442,10 @@ async function installTool(tool, version, os) {
await ghcupGHCHead();
break;
}
if (tool === 'ghc' && (0, compare_versions_1.compareVersions)('8.3', version)) {
// “version” may not be a semantic version (e.g. “latest-nightly”),
// so guard “compareVersions” with “validate”.
if (tool === 'ghc' &&
(!(0, compare_versions_1.validate)(version) || (0, compare_versions_1.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
5 changes: 4 additions & 1 deletion lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ async function installTool(tool, version, os) {
await ghcupGHCHead();
break;
}
if (tool === 'ghc' && (0, compare_versions_1.compareVersions)('8.3', version)) {
// “version” may not be a semantic version (e.g. “latest-nightly”),
// so guard “compareVersions” with “validate”.
if (tool === 'ghc' &&
(!(0, compare_versions_1.validate)(version) || (0, compare_versions_1.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
9 changes: 7 additions & 2 deletions 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