nektos / act

Run your GitHub Actions locally 🚀
https://nektosact.com
MIT License
52k stars 1.3k forks source link

Not able to use background tasks #2287

Open user-cube opened 2 months ago

user-cube commented 2 months ago

Bug report info

act version:            0.2.61
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 11
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:           
        /Users/ruicoelho/.actrc:
                -s GITHUB_TOKEN=
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.22.1
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.61
                DefaultGODEBUG:       httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
Docker Engine:
        Engine version:        25.0.3
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:            
        OS arch:               aarch64
        OS kernel:             6.6.16-linuxkit
        OS CPU:                11
        OS memory:             13461 MB
        Security options:
                name=seccomp,profile=unconfined
                name=cgroupns

Command used with act

act -W .github/workflows/node.yml

Describe issue

When running a pipeline intended to execute tasks in the background, the tool doesn't behave the same way as GitHub Actions; the task is almost ignored, with the step being considered successful.

Is there any way to adapt this so that I can have the same behavior as in GitHub Actions?

Example of working action

Act

image

Link to GitHub repository

https://github.com/user-cube/act

Workflow content

name: 'Background task'

on:
  push:

jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '14'
      - run: npm install
      - run: node app.js &
      - run: npx wait-on http://localhost:3000

Relevant log output

act -W .github/workflows/node.yml
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[Background task/setup] 🚀  Start image=catthehacker/ubuntu:act-latest
[Background task/setup]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Background task/setup]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Background task/setup]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Background task/setup]   ☁  git clone 'https://github.com/actions/setup-node' # ref=v2
[Background task/setup] ⭐ Run Main actions/checkout@v2
[Background task/setup]   🐳  docker cp src=/Users/ruicoelho/personal/act/. dst=/Users/ruicoelho/personal/act
[Background task/setup]   ✅  Success - Main actions/checkout@v2
[Background task/setup] ⭐ Run Main actions/setup-node@v2
[Background task/setup]   🐳  docker cp src=/Users/ruicoelho/.cache/act/actions-setup-node@v2/ dst=/var/run/act/actions/actions-setup-node@v2/
[Background task/setup]   🐳  docker exec cmd=[node /var/run/act/actions/actions-setup-node@v2/dist/setup/index.js] user= workdir=
[Background task/setup]   💬  ::debug::isExplicit:
[Background task/setup]   💬  ::debug::explicit? false
[Background task/setup]   💬  ::debug::isExplicit: 14.21.3
[Background task/setup]   💬  ::debug::explicit? true
[Background task/setup]   💬  ::debug::evaluating 1 versions
[Background task/setup]   💬  ::debug::matched: 14.21.3
[Background task/setup]   💬  ::debug::checking cache: /opt/hostedtoolcache/node/14.21.3/arm64
[Background task/setup]   💬  ::debug::Found tool in cache node 14.21.3 arm64
| Found in cache @ /opt/hostedtoolcache/node/14.21.3/arm64
[Background task/setup]   ❓ add-matcher /run/act/actions/actions-setup-node@v2/.github/tsc.json
[Background task/setup]   ❓ add-matcher /run/act/actions/actions-setup-node@v2/.github/eslint-stylish.json
[Background task/setup]   ❓ add-matcher /run/act/actions/actions-setup-node@v2/.github/eslint-compact.json
[Background task/setup]   ✅  Success - Main actions/setup-node@v2
[Background task/setup]   ⚙  ::add-path:: /opt/hostedtoolcache/node/14.21.3/arm64/bin
[Background task/setup] ⭐ Run Main npm install
[Background task/setup]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
| npm WARN act@1.0.0 No description
| npm WARN act@1.0.0 No repository field.
|
| added 64 packages from 41 contributors and audited 64 packages in 1.425s
|
| 12 packages are looking for funding
|   run `npm fund` for details
|
| found 0 vulnerabilities
|
[Background task/setup]   ✅  Success - Main npm install
[Background task/setup] ⭐ Run Main node app.js &
[Background task/setup]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=
[Background task/setup]   ✅  Success - Main node app.js &
[Background task/setup] ⭐ Run Main npx wait-on http://localhost:3000
[Background task/setup]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4] user= workdir=
| npx: installed 20 in 6.088s

Additional information

No response

Papillon6814 commented 1 month ago

Same issue here