setup-purescript
setup-purescript copied to clipboard
Not working locally with act
I am trying to simulate the workflow locally with act, but I am getting this error:
[CI/build] 💬 ::debug::finished caching tool
| Cached path /opt/hostedtoolcache/spago/0.20.9/x64, adding to PATH
| Fetching psa
| [command]/usr/bin/sudo npm install -g [email protected]
| sudo: npm: command not found
I tried the default config, and even adding
- uses: actions/setup-node@v3
with:
node-version: latest
cache: 'npm'
before uses: purescript-contrib/setup-purescript@main
it still happens.
I haven’t used act before so I’m not sure how to solve this. We use NPM because GitHub’s runners have node by default, and therefore npm; if act doesn’t have that, then you’ll have to install it somehow
I have no idea why, but this works:
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
cache: 'npm'
- run: npm install -g bats
- run: bats -v
The only difference is the missing sudo
:thinking: there is a reason for the sudo?
I can't remember why the sudo
is there, although the explicit case statement on Windows vs. non-Windows makes me suspicious that there is a reason for it. I'm happy to remove it if it is not necessary.
Yeah, 32fa32c73cf4297dee0da2cedf6c9c674281d55f adds the code block /src/Setup/GetTool.purs
, but it's interesting to see that on Windows it uses npm without sudo
. I'll try to change it and see what happens in a real linux runner.
I encountered the same issue. I was trying to be a good citizen and run github action with act
before opening a PR.
At the same time I'm wondering if this isn't more of an issue of act
rather than this action. act
is supposed to behave the same way a github runner would.
@klarkc Did you find something out regarding sudo
?
| Fetching psa
| [command]/usr/bin/sudo npm install -g [email protected]
| sudo: npm: command not found
[Publish Package/build] ❗ ::error::The process '/usr/bin/sudo' failed with exit code 1
[Publish Package/build] ❌ Failure - Main Setup PureScript
[Publish Package/build] ⚙ ::add-path:: /opt/hostedtoolcache/purs/0.15.7/x64
[Publish Package/build] ⚙ ::add-path:: /opt/hostedtoolcache/spago/0.20.9/x64
[Publish Package/build] exitcode '1': failure
[Publish Package/build] ⭐ Run Post Install pnpm
[Publish Package/build] 🐳 docker exec cmd=[node /var/run/act/actions/[email protected]/dist/index.js] user= workdir=
| Pruning is unnecessary.
[Publish Package/build] ✅ Success - Post Install pnpm
[Publish Package/build] 🏁 Job failed
Error: Job 'build' failed
Nop. I'm guessing here, but I believe the origin of the bug is npm not being installed by default. Even so, the action should not rely in this npm. Because people normally use actions/setup-node
which patches the user environment, and not the embeded npm. It hides a potential bug by using unexpected npm versions.