Skip to content

Conversation

@vpetersson
Copy link
Contributor

@vpetersson vpetersson commented Apr 18, 2025

This PR addresses several issues causing failures in the Nix and Rust CI workflows.

Context:

  • The Nix build started failing due to a Cargo.lock file generated with a newer Rust version (v4 format) being incompatible with the older Rust toolchain (1.77.2) provided by the nixos-24.05 Nixpkgs channel.
  • The Nix cache action (magic-nix-cache-action) was also deprecated and causing errors.
  • After resolving the initial Nix issues by reverting Cargo.lock, subsequent Rust test failures and compilation errors occurred due to code incompatibilities with Rust 1.77.2 and platform-specific test behavior.
  • The Rust workflow was using the abandoned actions-rs/toolchain action.

Changes:

  • .github/workflows/nix.yml:
    • Replaced the deprecated DeterminateSystems/magic-nix-cache-action with the recommended DeterminateSystems/flakehub-cache-action.
    • Added necessary permissions block (id-token: write, contents: read) for the flakehub-cache-action.
    • Reverted Cargo.lock to the v3 format version compatible with Rust 1.77.2 from the nixos-24.05 channel (done manually, reflected in git history).
  • .github/workflows/rust.yml:
    • Removed the abandoned actions-rs/toolchain action.
    • Implemented a matrix strategy to test against latest, 1.86.0 (stable), and 1.77.2 Rust versions.
    • Switched build and test steps to execute within Docker containers using the official rust images corresponding to the matrix versions.
    • Added caching using actions/cache@v4 for Cargo registry/git data and the ./target directory to improve performance.
    • Added Cargo.lock to workflow trigger paths.
  • src/commands/edge_app/utils.rs:
    • Modified the failing test test_transform_edge_app_instance_path_to_instance_manifest_with_env_instance_override_should_return_overrided_manifest_path to compare only the filenames instead of full paths. This resolves failures caused by differing temporary directory paths between macOS and Linux build environments.
  • src/commands/serde_utils.rs:
    • Replaced the use of Option::is_none_or (stabilized in Rust 1.86) with the equivalent Option::map_or(|s| s.is_empty()) logic to ensure compatibility with the older Rust 1.77.2 toolchain used in the Nix build.

Reasoning:

  • Reverting Cargo.lock was chosen over overriding the Rust version in flake.nix to maintain stability and avoid using the nixos-unstable channel.
  • Switching the Rust workflow to Docker provides explicit control over the toolchain version and replaces the unmaintained action, while caching minimizes performance impact.
  • Code modifications ensure compatibility with the required older Rust version and fix platform-specific test fragility.

@vpetersson vpetersson changed the title Bumps flake file Reverts Cargo.lock Apr 18, 2025
@vpetersson vpetersson changed the title Reverts Cargo.lock **Title:** Fix CI Builds for Nix and Rust Apr 18, 2025
@vpetersson vpetersson changed the title **Title:** Fix CI Builds for Nix and Rust Fix CI Builds for Nix and Rust Apr 18, 2025
@vpetersson vpetersson merged commit c2dd531 into master Apr 18, 2025
9 checks passed
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

Successfully merging this pull request may close these issues.

1 participant