-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
629d5d6
commit 2d75101
Showing
1 changed file
with
280 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,291 @@ | ||
name: Publish to GitHub Package Registry | ||
name: "/setup" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "**.md" | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
workflow_dispatch: | ||
|
||
on: [push] | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
test: | ||
name: Unit Tests - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
cache-dependency-path: package-lock.json | ||
- run: npm ci --prefer-offline --no-audit --progress=false | ||
- run: npm run bundle | ||
- run: npm test | ||
- name: Ensure generated files are up-to-date | ||
run: git diff --exit-code dist/ lib/ | ||
|
||
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 | ||
# Latest ghc with cabal head | ||
- ghc: latest | ||
cabal: head | ||
# 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. | ||
|
||
runs-on: ubuntu-latest | ||
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@v1 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
registry-url: https://npm.pkg.github.com/ | ||
node-version: 14.x | ||
scope: '@dalenguyen' | ||
- name: npm install, build, and test | ||
run: | | ||
npm install | ||
npm run build --if-present | ||
npm test | ||
- name: publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
run: | | ||
npm run deploy | ||
- name: Test | ||
|
||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
- uses: actions/checkout@v4 | ||
|
||
jobs: | ||
test: | ||
- uses: ./ | ||
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 | ||
if [[ "${{ steps.setup.outputs.cabal-version }}" == "head" ]] | ||
then | ||
CABALVER_EXPECTED=$( \ | ||
curl --silent https://raw.githubusercontent.com/haskell/cabal/master/cabal-install/cabal-install.cabal | \ | ||
sed -E -n 's/^Version:[[:space:]]+//p' \ | ||
) | ||
echo "Cabal head: ${CABALVER_EXPECTED}" | ||
else | ||
CABALVER_EXPECTED="${{ steps.setup.outputs.cabal-version }}" | ||
fi | ||
[[ "${CABALVER_EXPECTED}" == ${CABALVER}* ]] && \ | ||
[[ "${GHCVER}" == "${GHCVER_EXPECTED}" ]] | ||
- name: Test runghc | ||
run: | | ||
runghc --version | ||
runghc __tests__/hello.hs | ||
- name: Build test project | ||
working-directory: __tests__/project | ||
run: cabal build | ||
|
||
- name: Run test project | ||
working-directory: __tests__/project | ||
run: cabal run | ||
|
||
- name: Install test project | ||
working-directory: __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: __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: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./ | ||
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.9.3"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install bats | ||
run: git clone --depth 1 https://github.com/sstephenson/bats.git | ||
- name: Run tests | ||
run: PATH="./bats/bin:$PATH" script/test | ||
- name: Verify download URL checksums | ||
if: github.event_name == 'pull_request' | ||
run: ./script/mirror verify "$COMMIT_RANGE" | ||
env: | ||
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}.. | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- uses: ./ | ||
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 | ||