Skip to content

Cargo Dependencies on Linux Runner #224

@Abhay2412

Description

@Abhay2412

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://git@github.com/".insteadOf "https://github.com/"
      - name: Give GitHub Actions access to Crate 1 Repo
        uses: webfactory/ssh-agent@v0.9.0
        with:
          ssh-private-key: ${{ secrets.CRATE1DEPLOYKEY }}
      - name: Give GitHub Actions access to Crate 2 Repo
        uses: webfactory/ssh-agent@v0.9.0
        with:
          ssh-private-key: ${{ secrets.CRATE2DEPLOYKEY }}
      - name: Give GitHub Actions access to Crate 3 Repo
        uses: webfactory/ssh-agent@v0.9.0
        with:
          ssh-private-key: ${{ secrets.CRATE3DEPLOYKEY }}
      - name: Give GitHub Actions access to Crate 4 Repo
        uses: webfactory/ssh-agent@v0.9.0
        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://git@github.com/{Crate1Repo}.git" }
CRATE2= { git = "ssh://git@github.com/{Crate2Repo}.git" }
CRATE3= { git = "ssh://git@github.com/{Crate3Repo}.git" }
CRATE4= { git = "ssh://git@github.com/{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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions