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

Cargo Dependencies on Linux Runner #224

Open
Abhay2412 opened this issue Aug 1, 2024 · 2 comments
Open

Cargo Dependencies on Linux Runner #224

Abhay2412 opened this issue Aug 1, 2024 · 2 comments

Comments

@Abhay2412
Copy link

Hello, I am trying to run a workflow to make a deb file for a Flutter project that communicates with Rust. We have some private repos that are being called in our project as dependencies.

According to the documentation this works for Windows I tried adding it to my workflow as well https://github.com/marketplace/actions/webfactory-ssh-agent#cargos-rust-private-dependencies-on-windows but I am still get an error for some reason:

name: Building App on Linux
on:
  push:
    branches:
      - workflows
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Configure git to use SSH
        run: |
          git config --global url."ssh://[email protected]/".insteadOf "https://github.com/"
      - name: Give GitHub Actions access to Crate 1 Repo
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.CRATE1DEPLOYKEY }}
      - name: Give GitHub Actions access to Crate 2 Repo
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.CRATE2DEPLOYKEY }}
      - name: Give GitHub Actions access to Crate 3 Repo
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.CRATE3DEPLOYKEY }}
      - name: Give GitHub Actions access to Crate 4 Repo
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.CRATE4DEPLOYKEY }}
      - name: Add GitHub to known hosts
        run: |
          mkdir -p ~/.ssh
          ssh-keyscan github.com >> ~/.ssh/known_hosts
      - name: Update cargo config to use Git CLI
        run: echo -e "[net]\ngit-fetch-with-cli = true" > ~/.cargo/config.toml  
      - uses: subosito/flutter-action@v2
        with:
          flutter-version: "3.x"
          cache: true
          channel: stable
      - name: Install dependencies
        run: |
          flutter pub get
          sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
      - name: Build Linux Distribution
        run: |
          dart pub global activate flutter_distributor
          flutter_distributor release --name=dev --jobs=release-dev-linux-deb
      - name: Upload Distribution
        uses: actions/upload-artifact@v2
        with:
          name: linux-deb
          path: dist/

The Cargo.toml file:

[package]
name = "app"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib", "staticlib"]

[dependencies]
flutter_rust_bridge = "=2.1.0"
anyhow = "1.0.86"
lazy_static = "1.5.0"
plotters = "0.3.6"
rustfft = "6.2.0"

CRATE1= { git = "ssh://[email protected]/{Crate1Repo}.git" }
CRATE2= { git = "ssh://[email protected]/{Crate2Repo}.git" }
CRATE3= { git = "ssh://[email protected]/{Crate3Repo}.git" }
CRATE4= { git = "ssh://[email protected]/{Crate4Repo}.git" }

The error I get when the workflow gets to the step of Building the Linux distribution:
SEVERE: error: failed to get `CRATE1` as a dependency of package `app v0.1.0
I'm hoping to get some insight on what I'm doing wrong and guidance.

@boroskoyo
Copy link

Hi, i've just faced a similar issue and this article helped me about the setup: https://adventures.michaelfbryan.com/posts/configuring-cargo-auth-in-github-actions/

other than that since all your git strings are already starting with "ssh://..."

seems redundant

@Abhay2412
Copy link
Author

Hi, i've just faced a similar issue and this article helped me about the setup: https://adventures.michaelfbryan.com/posts/configuring-cargo-auth-in-github-actions/

other than that since all your git strings are already starting with "ssh://..."

seems redundant

Appreciate the feedback and your reply I think the ssh agent step works it's just for some reason Cargo.toml is not able to recognize the repos maybe some configuration settings I am missing and thanks for the article was following it.

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