8000 Does this action reuse pre-installed versions of GHC and Cabal? · Issue #119 · haskell-actions/setup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Does this action reuse pre-installed versions of GHC and Cabal? #119

New issue

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

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

Already on GitHub? Sign in to your account

Open
langston-barrett opened this issue Apr 10, 2025 · 1 comment
Open

Comments

@langston-barrett
Copy link
langston-barrett commented Apr 10, 2025

The README says:

The GitHub runners come with pre-installed versions of GHC and Cabal. Those will be used whenever possible.

But check out this workflow run:

Run cabal --version
  
cabal-install version 3.14.1.1
compiled using version 3.14.1.1 of the Cabal library

but

Resolved cabal latest to 3.14.1.1
Preparing ghc environment
Installing ghc version 9.8.4
Preparing cabal environment
Installing cabal version 3.14.1.1
  /opt/hostedtoolcache/ghcup/0.1.50.1/x64/ghcup whereis cabal 3.14.1.1
  [ Error ] [�
  Attempting to access tool cabal at location /opt/cabal/3.14/bin
  Failed to access tool cabal at location /opt/cabal/3.14/bin
  Attempting to access tool cabal at location /home/runner/.ghcup/bin
  Succeeded accessing tool cabal at location /home/runner/.ghcup/bin
  /opt/hostedtoolcache/ghcup/0.1.50.1/x64/ghcup set cabal 3.14.1.1
  [ Error ] [�
  /opt/hostedtoolcache/ghcup/0.1.50.1/x64/ghcup unset cabal
  [ Info  ] Cabal successfully unset
  Attempting to install cabal 3.14.1.1 using ghcup
  /opt/hostedtoolcache/ghcup/0.1.50.1/x64/ghcup install cabal 3.14.1.1
  [ Info  ] downloading: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.14.1.1/cabal-install-3.14.1.1-x86_64-linux-ubuntu22.04.tar.xz as file /usr/local/.ghcup/tmp/ghcup-4e6b75f5cebe0ee4/cabal-install-3.14.1.1-x86_64-linux-ubuntu22.04.tar.xz

It appears that the requested version match the pre-installed version, but then ghcup is still downloading and re-installing the same Cabal version. Am I reading this wrong? Or is this possibly a bug?

Workflow file (not quite minimal)
name: CI

on:
  push:
  pull_request:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        ghc: ["9.4.8", "9.6.6", "9.8.4"]
        os: [ubuntu-22.04]
      # complete all jobs
      fail-fast: false
    name: GREASE - GHC v${{ matrix.ghc }}
    steps:
    - run: cabal --version

    - uses: haskell-actions/setup@v2
      with:
        ghc-version: ${{ matrix.ghc }}
@andreasabel
Copy link
Member

It seems it relies on actions/tool-cache to find pre-installed tools:

setup/src/installer.ts

Lines 69 to 76 in 64445b6

async function isInstalled(
tool: Tool,
version: string,
os: OS,
arch: Arch
): Promise<boolean> {
const toolPath = tc.find(tool, version);
if (toolPath) return success(tool, version, toolPath, os);

The docs don't say whether find is supposed to work correctly for pre-installed tools: https://github.com/actions/toolkit/blob/1b1e81526b802d1d641911393281c2fb45ed5f11/packages/tool-cache/README.md
It is likely that it should, however, see e.g. https://github.com/actions/runner-images/discussions/8010#discussioncomment-6603600

If you want to dig into this issue, very welcome!
One could maybe start with logging which versions are in the tool cache, using tc.findAllVersions('cabal') etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0