Skip to content
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

Not working locally with act #32

Open
klarkc opened this issue Oct 15, 2022 · 6 comments
Open

Not working locally with act #32

klarkc opened this issue Oct 15, 2022 · 6 comments

Comments

@klarkc
Copy link

klarkc commented Oct 15, 2022

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.

@thomashoneyman
Copy link
Collaborator

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

@klarkc
Copy link
Author

klarkc commented Oct 16, 2022

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 🤔 there is a reason for the sudo?

@thomashoneyman
Copy link
Collaborator

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.

@klarkc
Copy link
Author

klarkc commented Oct 18, 2022

Yeah, 32fa32c 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.

@andys8
Copy link

andys8 commented Jan 27, 2023

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

@klarkc
Copy link
Author

klarkc commented Jan 27, 2023

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.

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

No branches or pull requests

3 participants