Repository: cross-rs/cross
Pull request #951 (2022-07-15 23:04:38)

remove actions-rs
This essentially removes all actions-rs actions and replaces it with what is needed.

Reason for this is due to actions-rs being seemingly unmaintained

Emilgardis: this follows the general consensus as discussed in https://github.com/actions-rs/toolchain/issues/216

it also adds a matcher, which would otherwise be gone
Alexhuszagh: Weird, the changelog check only uses `serde_json` here, so I wonder. Also, the filter shouldn't be running on that directory.
https://github.com/cross-rs/cross/runs/7379312457?check_suite_focus=true#step:3:71
Emilgardis: bors r=@Alexhuszagh 
bors[bot]: Build failed:
  * [conclusion](https://github.com/cross-rs/cross/runs/7771388015?check_suite_focus=true)
Emilgardis: bors try --target x86_64-unknown-linux-gnu

will squash (and rebase) on success)

bors[bot]: ## try

Build succeeded:
  * [conclusion](https://github.com/cross-rs/cross/runs/7772178393?check_suite_focus=true)
Alexhuszagh: bors try --target x86_64-unknown-linux-gnu

going to give it a careful re-review, but looks good so far.
bors[bot]: ## try

Build succeeded:
  * [conclusion](https://github.com/cross-rs/cross/runs/7814713755?check_suite_focus=true)
reitermarkus: Relatedly, but not necessarily relevant for this particular PR, I have been thinking about creating a `cross-rs/install` action which would install the `cross` binary from our GitHub releases rather than having to build it from source in CI every time.
Emilgardis: > Relatedly, but not necessarily relevant for this particular PR, I have been thinking about creating a `cross-rs/install` action which would install the `cross` binary from our GitHub releases rather than having to build it from source in CI every time.

That sounds good, it is possible to use https://github.com/taiki-e/install-action for now, but would be neat to have, and easy to support 👍🏼 
reitermarkus: Neat, didn't know about https://github.com/taiki-e/install-action.
Alexhuszagh: Still looks good after #1040, am I free to merge this @Emilgardis?
Emilgardis: Yep @Alexhuszagh 
Alexhuszagh: bors r=Alexhuszagh,reitermarkus
bors[bot]: Build failed:
  * [conclusion](https://github.com/cross-rs/cross/actions/runs/3168710823/jobs/5160235165)
Emilgardis: bors try --target *windows-msvc
Emilgardis: bors try --target *windows-msvc
Emilgardis: bors try --target *windows-msvc
bors[bot]: ## try

Already running a review
Emilgardis: bors try-
bors try --target *windows-msvc
Emilgardis: bors try-
bors try --target *windows-msvc
bors[bot]: ## try

Build failed:
  * [conclusion](https://github.com/cross-rs/cross/actions/runs/3169014559/jobs/5160668179)
Emilgardis: bors try --target *windows-msvc
bors[bot]: ## try

Build succeeded:
  * [conclusion](https://github.com/cross-rs/cross/actions/runs/3169135280/jobs/5160868699)
Emilgardis: it works!

<img width="464" alt="image" src="https://user-images.githubusercontent.com/1502855/193463530-90e5402c-5fc7-4b24-864e-d9e13f841c3c.png">


Patch:
diff --git a/.changes/1033.json b/.changes/1033.json
deleted file mode 100644
index 435d43d..0000000
--- a/.changes/1033.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-    "description": "fix --cache-from using podman.",
-    "type": "fixed",
-    "issues": [1031]
-}
diff --git a/.changes/1039.json b/.changes/1039.json
deleted file mode 100644
index 9053daa..0000000
--- a/.changes/1039.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-    "description": "support overlay and fuse-overlayfs storage drivers",
-    "type": "added"
-}
diff --git a/.github/actions/cargo-install-upload-artifacts/action.yml b/.github/actions/cargo-install-upload-artifacts/action.yml
index 07bd34f..69c66ca 100644
--- a/.github/actions/cargo-install-upload-artifacts/action.yml
+++ b/.github/actions/cargo-install-upload-artifacts/action.yml
@@ -29,17 +29,15 @@ runs:
       shell: bash
 
     - name: Build with all features
-      uses: actions-rs/cargo@v1
-      with:
-        command: install
-        args: >
+      run:
+        cargo install
           --locked
           --path .
           --target ${{ inputs.target }}
           --all-features
           --root ${{ steps.metadata.outputs.out-dir }}
           --bins
-        use-cross: true
+      shell: ${{ contains(runner.os, 'windows') && 'pwsh' || 'bash' }}
       env:
         RUSTFLAGS: "" # Make sure to unset RUSTFLAGS
 
diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml
index bcba680..ea2fc24 100644
--- a/.github/actions/cargo-publish/action.yml
+++ b/.github/actions/cargo-publish/action.yml
@@ -28,10 +28,8 @@ runs:
 
     - name: Log into crates.io
       if: github.event_name != 'pull_request'
-      uses: actions-rs/cargo@v1
-      with:
-        command: login
-        args: -- ${{ inputs.cargo-registry-token }}
+      run: cargo login -- ${{ inputs.cargo-registry-token }}
+      shell: bash
 
     - run: gh release delete --yes Unreleased || exit 0
       if: >
@@ -57,7 +55,5 @@ runs:
           ${{ steps.download-artifacts.outputs.download-path }}/cross-*/*
 
     - name: Publish crate
-      uses: actions-rs/cargo@v1
-      with:
-        command: publish
-        args: ${{ !startsWith(github.ref, 'refs/tags/v') && '--dry-run' || '' }}
+      run: cargo publish ${{ !startsWith(github.ref, 'refs/tags/v') && '--dry-run' || '' }}
+      shell: bash
diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml
index 0da1820..6681080 100644
--- a/.github/actions/setup-rust/action.yml
+++ b/.github/actions/setup-rust/action.yml
@@ -15,17 +15,15 @@ inputs:
 runs:
   using: composite
   steps:
-    # Work around for sporadic issues with rustup self-update on windows
-    - run: rustup set auto-self-update disable
-      if: contains(runner.os, 'windows')
-      shell: bash
     - name: Install Rust toolchain
-      uses: actions-rs/toolchain@v1
+      uses: dtolnay/rust-toolchain@v1
       with:
         toolchain: ${{ inputs.toolchain }}
         target: ${{ inputs.target }}
-        default: true
         components: ${{ inputs.components }}
-        profile: minimal
+
+    - name: Install rust matcher
+      run: echo "::add-matcher::.github/actions/setup-rust/rust.json"
+      shell: bash
 
     - uses: Swatinem/rust-cache@v1.3.0
diff --git a/.github/actions/setup-rust/rust.json b/.github/actions/setup-rust/rust.json
new file mode 100644
index 0000000..dbc4c79
--- /dev/null
+++ b/.github/actions/setup-rust/rust.json
@@ -0,0 +1,31 @@
+{
+  "problemMatcher": [
+    {
+      "owner": "rust",
+      "pattern": [
+        {
+          "regexp": "^(warning|warn|error)(\\[(.*)\\])?: (.*)$",
+          "severity": 1,
+          "message": 4,
+          "code": 3
+        },
+        {
+          "regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$",
+          "file": 2,
+          "line": 3,
+          "column": 4
+        }
+      ]
+    },
+    {
+      "owner": "cross-rs",
+      "pattern": [
+        {
+          "regexp": "^\\[cross\\] (warning|error): (.*)$",
+          "severity": 1,
+          "message": 2
+        }
+      ]
+    }
+  ]
+}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 792e119..630a112 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,10 +36,7 @@ jobs:
           components: rustfmt
 
       - name: Run rustfmt
-        uses: actions-rs/cargo@v1
-        with:
-          command: fmt
-          args: -- --check
+        run: cargo fmt -- --check
 
   clippy:
     runs-on: ${{ matrix.os }}
@@ -58,11 +55,7 @@ jobs:
           toolchain: 1.58.1 # MSRV, Minimally Supported Rust Version. Make sure to update README.md
 
       - name: Run clippy
-        uses: actions-rs/cargo@v1
-        with:
-          command: clippy
-          args: --locked --all-targets --all-features --workspace -- -D warnings
-
+        run: cargo clippy --locked --all-targets --all-features --workspace -- -D warnings
   test:
     runs-on: ${{ matrix.os }}
     strategy:
@@ -80,10 +73,7 @@ jobs:
           name: test-${{matrix.os}}
 
       - name: Run unit tests
-        uses: actions-rs/cargo@v1
-        with:
-          command: test
-          args: --locked --all-targets --workspace --all-features
+        run: cargo test --locked --all-targets --workspace --all-features
         timeout-minutes: 10
   check:
     runs-on: ubuntu-latest
@@ -94,7 +84,6 @@ jobs:
       - uses: ./.github/actions/setup-rust
       - run: cargo xtask ci-job check
         id: check
-        shell: bash
   generate-matrix:
     runs-on: ubuntu-latest
     outputs:
@@ -199,7 +188,6 @@ jobs:
         if: matrix.deploy
         with:
           target: ${{ matrix.target }}
-          image: ${{ steps.build-docker-image.outputs.image }}
 
       - name: Test Zig Image
         if: steps.prepare-meta.outputs.has-image && steps.prepare-meta.outputs.test-variant == 'zig'
@@ -319,45 +307,6 @@ jobs:
         run: ./ci/test-docker-in-docker.sh
         shell: bash
 
-  podman:
-    name: podman
-    runs-on: ubuntu-latest
-    needs: [shellcheck, test, check]
-    if: github.event_name == 'push'
-    strategy:
-      fail-fast: false
-    outputs:
-      has-image: ${{ steps.prepare-meta.outputs.has-image }}
-      images: ${{ steps.build-docker-image.outputs.images && fromJSON(steps.build-docker-image.outputs.images)  }}
-      coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
-    steps:
-      - uses: actions/checkout@v3
-
-      - uses: ./.github/actions/setup-rust
-
-      - name: Install Podman
-        env:
-          DEBIAN_FRONTEND: noninteractive
-        run: |
-          sudo apt-get update
-          sudo apt-get install podman --no-install-recommends --assume-yes
-
-      - name: LLVM instrument coverage
-        id: cov
-        uses: ./.github/actions/cargo-llvm-cov
-        with:
-          name: cross-podman-aarch64-unknown-linux-gnu
-
-      - name: Install cross
-        run: cargo install --path . --force --debug
-
-      - name: Run Podman Test
-        run: ./ci/test-podman.sh
-        env:
-          CROSS_CONTAINER_ENGINE: podman
-          TARGET: aarch64-unknown-linux-gnu
-        shell: bash
-
   publish:
     needs: [build, check, fmt, clippy, cargo-deny]
     runs-on: ubuntu-latest
@@ -370,7 +319,7 @@ jobs:
           github-token: ${{ secrets.GITHUB_TOKEN }}
 
   conclusion:
-    needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish, check, remote, bisect, docker-in-docker, foreign, podman]
+    needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish, check, remote, bisect, docker-in-docker, foreign]
     if: always()
     runs-on: ubuntu-latest
     steps:
diff --git a/src/docker/engine.rs b/src/docker/engine.rs
index f0aa536..f36b91d 100644
--- a/src/docker/engine.rs
+++ b/src/docker/engine.rs
@@ -17,45 +17,21 @@ pub enum EngineType {
     Docker,
     Podman,
     PodmanRemote,
-    Nerdctl,
     Other,
 }
 
 impl EngineType {
     /// Returns `true` if the engine type is [`Podman`](Self::Podman) or [`PodmanRemote`](Self::PodmanRemote).
     #[must_use]
-    pub const fn is_podman(&self) -> bool {
+    pub fn is_podman(&self) -> bool {
         matches!(self, Self::Podman | Self::PodmanRemote)
     }
 
     /// Returns `true` if the engine type is [`Docker`](EngineType::Docker).
     #[must_use]
-    pub const fn is_docker(&self) -> bool {
+    pub fn is_docker(&self) -> bool {
         matches!(self, Self::Docker)
     }
-
-    /// Returns `true` if the build command supports the `--output` flag.
-    #[must_use]
-    pub const fn supports_output_flag(&self) -> bool {
-        !matches!(self, Self::Other)
-    }
-
-    /// Returns `true` if the build command supports the `--pull` flag.
-    #[must_use]
-    pub const fn supports_pull_flag(&self) -> bool {
-        !matches!(self, Self::Nerdctl | Self::Other)
-    }
-
-    /// Returns `true` if the build command supports the `--cache-from type=` key.
-    ///
-    /// Some container engines, especially podman, do not support the `type`
-    /// key of `--cache-from` during the image build steps. They also do
-    /// not support any tags for the `--cache-from` steps either. See:
-    /// https://docs.podman.io/en/latest/markdown/podman-build.1.html#cache-from
-    #[must_use]
-    pub const fn supports_cache_from_type(&self) -> bool {
-        matches!(self, Self::Docker | Self::Nerdctl)
-    }
 }
 
 #[derive(Clone, Debug, PartialEq, Eq)]
@@ -156,8 +132,6 @@ fn get_engine_info(
         EngineType::PodmanRemote
     } else if stdout_help.contains("podman") {
         EngineType::Podman
-    } else if stdout_help.contains("nerdctl") {
-        EngineType::Nerdctl
     } else if stdout_help.contains("docker") && !stdout_help.contains("emulate") {
         EngineType::Docker
     } else {
diff --git a/src/docker/shared.rs b/src/docker/shared.rs
index 379bbbb..8ad2025 100644
--- a/src/docker/shared.rs
+++ b/src/docker/shared.rs
@@ -846,7 +846,7 @@ fn dockerinfo_parse_root_mount_path(info: &serde_json::Value) -> Result<MountDet
         .and_then(|v| v.as_str())
         .ok_or_else(|| eyre::eyre!("no driver name found"))?;
 
-    if driver_name.to_lowercase().contains("overlay") {
+    if driver_name == "overlay2" {
         let path = info
             .pointer("/0/GraphDriver/Data/MergedDir")
             .and_then(|v| v.as_str())
diff --git a/src/lib.rs b/src/lib.rs
index 76071fb..fc1cf01 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -756,15 +756,21 @@ pub(crate) fn warn_host_version_mismatch(
             host_version_meta.short_version_string
         );
         if versions.is_lt() || (versions.is_eq() && dates.is_lt()) {
-            msg_info.warn(format_args!("using older {rustc_warning}.\n > Update with `rustup update --force-non-host {toolchain}`"))?;
+            if cfg!(not(test)) {
+                msg_info.warn(format_args!("using older {rustc_warning}.\n > Update with `rustup update --force-non-host {toolchain}`"))?;
+            }
             return Ok(VersionMatch::OlderTarget);
         } else if versions.is_gt() || (versions.is_eq() && dates.is_gt()) {
-            msg_info.warn(format_args!(
-                "using newer {rustc_warning}.\n > Update with `rustup update`"
-            ))?;
+            if cfg!(not(test)) {
+                msg_info.warn(format_args!(
+                    "using newer {rustc_warning}.\n > Update with `rustup update`"
+                ))?;
+            }
             return Ok(VersionMatch::NewerTarget);
         } else {
-            msg_info.warn(format_args!("using {rustc_warning}."))?;
+            if cfg!(not(test)) {
+                msg_info.warn(format_args!("using {rustc_warning}."))?;
+            }
             return Ok(VersionMatch::Different);
         }
     }
diff --git a/xtask/src/build_docker_image.rs b/xtask/src/build_docker_image.rs
index c9d27d1..07df5bf 100644
--- a/xtask/src/build_docker_image.rs
+++ b/xtask/src/build_docker_image.rs
@@ -187,10 +187,8 @@ pub fn build_docker_image(
 
         if push {
             docker_build.arg("--push");
-        } else if engine.kind.supports_output_flag() && no_output {
+        } else if engine.kind.is_docker() && no_output {
             docker_build.args(["--output", "type=tar,dest=/dev/null"]);
-        } else if no_output {
-            msg_info.fatal("cannot specify `--no-output` with engine that does not support the `--output` flag", 1);
         } else if has_buildkit {
             docker_build.arg("--load");
         }
@@ -218,12 +216,10 @@ pub fn build_docker_image(
             tags = vec![target.image_name(&repository, tag)];
         }
 
-        if engine.kind.supports_pull_flag() {
-            docker_build.arg("--pull");
-        }
+        docker_build.arg("--pull");
         if no_cache {
             docker_build.arg("--no-cache");
-        } else if engine.kind.supports_cache_from_type() {
+        } else {
             docker_build.args([
                 "--cache-from",
                 &format!(
@@ -231,15 +227,6 @@ pub fn build_docker_image(
                     target.image_name(&repository, "main")
                 ),
             ]);
-        } else {
-            // we can't use `image_name` since podman doesn't support tags
-            // with `--cache-from`. podman only supports an image format
-            // of registry/repo although it does when pulling images. this
-            // affects building from cache with target+subs images since we
-            // can't use caches from registry. this is only an issue if
-            // building with podman without a local cache, which never
-            // happens in practice.
-            docker_build.args(["--cache-from", &format!("{repository}/{}", target.name)]);
         }
 
         if push {


Test patch:
diff --git a/ci/test-podman.sh b/ci/test-podman.sh
deleted file mode 100755
index 774977c..0000000
--- a/ci/test-podman.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-# shellcheck disable=SC1091,SC1090
-
-# test to see that running and building images with podman works.
-
-set -x
-set -eo pipefail
-
-export CROSS_CONTAINER_ENGINE=podman
-if [[ -z "${TARGET}" ]]; then
-    export TARGET="aarch64-unknown-linux-gnu"
-fi
-
-ci_dir=$(dirname "${BASH_SOURCE[0]}")
-ci_dir=$(realpath "${ci_dir}")
-. "${ci_dir}"/shared.sh
-
-main() {
-    local td=
-    local parent=
-    local target="${TARGET}"
-
-    retry cargo fetch
-    cargo build
-    export CROSS="${PROJECT_HOME}/target/debug/cross"
-
-    td="$(mkcargotemp -d)"
-    parent=$(dirname "${td}")
-    pushd "${td}"
-    cargo init --bin --name "hello" .
-
-    echo '[build]
-pre-build = ["apt-get update"]' > "${parent}/Cross.toml"
-
-    CROSS_CONTAINER_ENGINE="${CROSS_ENGINE}" "${CROSS}" build --target "${target}" --verbose
-
-    popd
-    rm -rf "${td}"
-}
-
-main