nektos / act

Run your GitHub Actions locally πŸš€
https://nektosact.com
MIT License
53.7k stars 1.34k forks source link

act doesn't seem to work with actions-rs/toolchain@v1 #1295

Closed alexjyong closed 1 year ago

alexjyong commented 2 years ago

Bug report info

act version:            0.2.30
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 16
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
    /var/run/docker.sock
Config files:           
    /home/ajyong/.actrc:
        -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest
        -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-20.04
        -P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:full-18.04
Build info:
    Go version:            go1.18.4
    Module path:           command-line-arguments
    Main version:          
    Main path:             
    Main checksum:         
    Build settings:
        -compiler:            gc
        -ldflags:             -X main.version=0.2.30
        CGO_ENABLED:          1
        CGO_CFLAGS:           
        CGO_CPPFLAGS:         
        CGO_CXXFLAGS:         
        CGO_LDFLAGS:          
        GOARCH:               amd64
        GOOS:                 linux
        GOAMD64:              v1
Docker Engine:
    Engine version:        20.10.17
    Engine runtime:        runc
    Cgroup version:        2
    Cgroup driver:         systemd
    Storage driver:        overlay2
    Registry URI:          https://index.docker.io/v1/
    OS:                    Rolling Rhino Remix
    OS type:               linux
    OS version:            22.04
    OS arch:               x86_64
    OS kernel:             5.18.14-051814-generic
    OS CPU:                16
    OS memory:             31515 MB
    Security options:
        name=apparmor
        name=seccomp,profile=default
        name=cgroupns

Command used with act

act -j BuildPackage

Describe issue

I'm trying to run a github action to build a package in my repo. This process requests some Rust tools, so I'm using the actions-rs/toolchain@v1 with Github Actions.

This works on Github, but when I run this locally, I get this error: error: rustup is not installed at '/root/.cargo'

I'll paste full logs in the log output section. Not too sure what is going on here.

Link to GitHub repository

https://github.com/alexjyong/synapse-wrapper

Workflow content

# This is a basic workflow that is manually triggered

name: Build Service

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "greet"
  BuildPackage:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:

    - name: Set up QEMU
      uses: docker/setup-qemu-action@v1

    - name: Set up Docker Buildx        
      uses: docker/setup-buildx-action@v1     

    - uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true

    - uses: actions/cache@v3
      id: cache
      with:
        path: |
          ~/.cargo/bin/
          ~/.cargo/registry/index/
          ~/.cargo/registry/cache/
          ~/.cargo/git/db/
          target/
        key: ${{ runner.os }}-cargo-compat-${{ hashFiles('**/system-images/compat/Cargo.lock') }}

    - name: Install packages
      run: |
           sudo snap install yq
           sudo apt-get install -y build-essential openssl libssl-dev libc6-dev clang libclang-dev ca-certificates

    - name: do cargo stuff
      id: cargo-stuff
      if: steps.cache.outputs.cache-hit != 'true'
      run: cargo install toml-cli

    - name: install package manager stuff
      run: |
           cd ~/ && git clone https://github.com/Start9Labs/embassy-os.git;
           cd embassy-os;
           git submodule update --init
           cd patch-db;
           git submodule update --init;
           cd ../
           cd backend;
           ./install-sdk.sh;

           cd ~/ && git clone https://github.com/Start9Labs/synapse-wrapper.git
           cd synapse-wrapper
           git submodule update --init
           make

Relevant log output

[Build Service/BuildPackage] ⭐ Run Main actions-rs/toolchain@v1
[Build Service/BuildPackage]   🐳  docker cp src=/home/ajyong/.cache/act/actions-rs-toolchain@v1/ dst=/var/run/act/actions/actions-rs-toolchain@v1/
[Build Service/BuildPackage] close /tmp/act561145434: file already closed
[Build Service/BuildPackage]   🐳  docker exec cmd=[node /var/run/act/actions/actions-rs-toolchain@v1/dist/index.js] user= workdir=
[Build Service/BuildPackage]   πŸ’¬  ::debug::using toolchain from input: stable
| [command]/usr/share/rust/.cargo/bin/rustup show
| Default host: x86_64-unknown-linux-gnu
| rustup home:  /root/.rustup
| 
| no active toolchain
| [command]/usr/share/rust/.cargo/bin/rustup toolchain install stable
| info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
| info: latest update on 2022-07-19, rust version 1.62.1 (e092d0b6b 2022-07-16)
| info: downloading component 'cargo'
| info: downloading component 'clippy'
| info: downloading component 'rust-docs'
| info: downloading component 'rust-std'
| info: downloading component 'rustc'
| info: downloading component 'rustfmt'
| info: installing component 'cargo'
| info: installing component 'clippy'
| info: installing component 'rust-docs'
| info: installing component 'rust-std'
| info: installing component 'rustc'
| info: installing component 'rustfmt'
| 
|   stable-x86_64-unknown-linux-gnu installed - rustc 1.62.1 (e092d0b6b 2022-07-16)
| 
| info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
| error: rustup is not installed at '/root/.cargo'
[Build Service/BuildPackage]   ❗  ::error::The process '/usr/share/rust/.cargo/bin/rustup' failed with exit code 1
[Build Service/BuildPackage]   ❌  Failure - Main actions-rs/toolchain@v1

Additional information

No response

NicolaLS commented 2 years ago

I think I had the same issue on ubuntu but now on fedora it works for me

alexjyong commented 2 years ago

This happens on macOS as well:

act version:            0.2.26
GOOS:                   darwin
GOARCH:                 amd64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is unset/empty.
Sockets found:
    /var/run/docker.sock
Config files:
    /Users/ajyong/.actrc:
        -P ubuntu-latest=nektos/act-environments-ubuntu:18.04
Docker Engine:
    Engine version:        20.10.14
    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:               x86_64
    OS kernel:             5.10.104-linuxkit
    OS CPU:                6
    OS memory:             7859 MB
    Security options:
        name=seccomp,profile=default
        name=cgroupns
[Build Service/BuildPackage]   πŸ’¬  ::debug::using toolchain from input: stable
| [command]/usr/share/rust/.cargo/bin/rustup show
| Default host: x86_64-unknown-linux-gnu
| rustup home:  /root/.rustup
|
| no active toolchain
| [command]/usr/share/rust/.cargo/bin/rustup toolchain install stable
| info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
| info: latest update on 2022-07-19, rust version 1.62.1 (e092d0b6b 2022-07-16)
| info: downloading component 'cargo'
| info: downloading component 'clippy'
| info: downloading component 'rust-docs'
| info: downloading component 'rust-std'
| info: downloading component 'rustc'
| info: downloading component 'rustfmt'
| info: installing component 'cargo'
| info: installing component 'clippy'
| info: installing component 'rust-docs'
| info: installing component 'rust-std'
| info: installing component 'rustc'
| info: installing component 'rustfmt'
|
|   stable-x86_64-unknown-linux-gnu installed - rustc 1.62.1 (e092d0b6b 2022-07-16)
|
| info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
| error: rustup is not installed at '/root/.cargo'
[Build Service/BuildPackage]   ❗  ::error::The process '/usr/share/rust/.cargo/bin/rustup' failed with exit code 1
[Build Service/BuildPackage]   ❌  Failure - actions-rs/toolchain@v1
[Build Service/BuildPackage] exit with `FAILURE`: 1

@NicolaLS do you know what you did with fedora to get it to work? Or did it Just Workβ„’?

NicolaLS commented 2 years ago

It just worked, sorry. I remember I tried everything on ubuntu like installing the toolchain manualy in the docker container with exec (which was stupid), but I just couldn't get it to work I just found this idk if that can help you: act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest

NicolaLS commented 2 years ago

Ok this is crazy it worked for me but I had another problem:

Caused by:
|   process didn't exit successfully: `/home/sus/Documents/projects/fedimint/minimint/target/debug/build/librocksdb-sys-61b0b7ad3a073296/build-script-build` (exit status: 101)
|   --- stderr
|   thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2144:31
|   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
| warning: build failed, waiting for other jobs to finish...

when I tried to solve it (sudo apt-get ..) I got the same error that you have, now I tried to get it back to my old problem by removing the installation, I also completely removed all docker stuff and cleaned everything..But the error won't go away now (the same that you have) I am so confused right now.....

alexjyong commented 2 years ago

I tried out using the ubuntu:rust-latest and now I get a new error:

| error: could not rename component file from '/usr/share/rust/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/clippy' to '/usr/share/rust/.rustup/tmp/dugaewb5sq2zryps_dir/bk': Invalid cross-device link (os error 18)
NicolaLS commented 2 years ago

@alexjyong if I try it with that I get:

| E: Unable to locate package clang
| E: Unable to locate package libclang-dev
[CI/Unit Tests]   ❌  Failure - Main Install packages
github-actions[bot] commented 1 year ago

Issue is stale and will be closed in 14 days unless there is new activity

Elendol commented 1 year ago

I have the same issue, I tried to use the rust image but the rust used by the actions after actions-rs/toolchain@v1 do not use the one installed via this action but rather the one from the image. For example crate-ci/typos@master requires rust at least 1.60.0 but complain of only finding 1.58.0 even though I explicitly ask the toolchain action to use 1.60.0 (same with stable).

[Spelling/Spell Check with Typos]   πŸ’¬  ::debug::using toolchain from input: 1.60.0
| [command]/usr/share/rust/.cargo/bin/rustup show
| Default host: x86_64-unknown-linux-gnu
| rustup home:  /usr/share/rust/.rustup
|
| stable-x86_64-unknown-linux-gnu (default)
| rustc 1.53.0 (53cb7b09b 2021-06-17)
| [command]/usr/share/rust/.cargo/bin/rustup toolchain install 1.60.0
| info: syncing channel updates for '1.60.0-x86_64-unknown-linux-gnu'
| info: latest update on 2022-04-07, rust version 1.60.0 (7737e0b5c 2022-04-04)
| info: downloading component 'cargo'
| info: downloading component 'rust-std'
| info: downloading component 'rustc'
| info: installing component 'cargo'
| info: installing component 'rust-std'
| info: installing component 'rustc'
| 
|   1.60.0-x86_64-unknown-linux-gnu installed - rustc 1.60.0 (7737e0b5c 2022-04-04)
|
| info: checking for self-updates
| info: downloading self-update
[Spelling/Spell Check with Typos]   ❓  ::group::Gathering installed versions
| [command]/usr/share/rust/.cargo/bin/rustc -V
| rustc 1.53.0 (53cb7b09b 2021-06-17)
[Spelling/Spell Check with Typos]   βš™  ::set-output:: rustc=1.53.0 (53cb7b09b 2021-06-17)
[Spelling/Spell Check with Typos]   βš™  ::set-output:: rustc_hash=53cb7b09b
| [command]/usr/share/rust/.cargo/bin/cargo -V
| cargo 1.53.0 (4369396ce 2021-04-27)
[Spelling/Spell Check with Typos]   βš™  ::set-output:: cargo=1.53.0 (4369396ce 2021-04-27)
| [command]/usr/share/rust/.cargo/bin/rustup -V
| rustup 1.25.1 (bb60b1e89 2022-07-12)
| info: This is the version for the rustup toolchain manager, not the rustc compiler.
| info: The currently active `rustc` version is `rustc 1.53.0 (53cb7b09b 2021-06-17)`

(...)

[Spelling/Spell Check with Typos] [DEBUG] error: failed to compile `typos-cli v1.12.4 (/usr/src/typos)`, intermediate artifacts can be found at `/usr/src/typos/target`

Caused by:
  package `varcon-core v2.2.5 (/usr/src/typos/crates/varcon-core)` cannot be built because it requires rustc 1.60.0 or newer, while the currently active rustc version is 1.58.1

[Spelling/Spell Check with Typos] [DEBUG] The command '/bin/sh -c cargo install --path .' returned a non-zero code: 101
NicolaLS commented 1 year ago

I saw rust-bitcoin having an act setup but didn't have time to look at it yet (in case somebody wants to investigate how they do it)

Bjohnson131 commented 1 year ago

Same issue here.

github-actions[bot] commented 1 year ago

Issue is stale and will be closed in 14 days unless there is new activity

mcintyre94 commented 1 year ago

I think the issue here is basically that ubuntu-latest has rustup installed in Github, but not available when running in act

So if you have something like run: rustup toolchain install stable --profile minimal (or any action that's basically doing that under the hood) it errors in act but works in Github.

github-actions[bot] commented 1 year ago

Issue is stale and will be closed in 14 days unless there is new activity

djhunter67 commented 1 year ago

-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest

This just SOLVED the curl issue with the Rust CI using act! Thank you.