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

ci: fix CI by correcting wrong cfg value & removing cache with sudo #2394

Merged
merged 7 commits into from
May 5, 2024

Conversation

SteveLauC
Copy link
Member

@SteveLauC SteveLauC commented May 5, 2024

What does this PR do

This PR tries to fix the CI, there are 2 issues here:

  1. New nightly toolchain added checks for cfg values, and they work pretty well

    1. there are few typos in our cfg values (which is really unfortunate) fushsia -> fuchsia
    2. target_arch = x32 does not exist
  2. For CI that are using our MSRV toolchain, the last step before_cache_script would fail with Permission denied because the files that it wants to delete are owned by root: https://github.com/nix-rust/nix/actions/runs/8958096003/job/24601956503?pr=2394

    This is kinda weird because it didn't happen in the past, and for now, it only happens with our MSRV toolchain.

uid=1001(runner) gid=127(docker) groups=127(docker),4(adm),101(systemd-journal)
/home/runner/.cargo/registry/index
├── [root     root    ]  gh.neting.cc-1ecc6299db9ec823
│   ├── [root     root    ]  .cache
│   │   ├── [root     root    ]  3
│   │   │   └── [root     root    ]  s
│   │   │       └── [root     root    ]  syn
│   │   ├── [root     root    ]  as
│   │   │   └── [root     root    ]  se
│   │   │       └── [root     root    ]  assert-impl
│   │   ├── [root     root    ]  au
│   │   │   └── [root     root    ]  to
│   │   │       └── [root     root    ]  autocfg

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

@SteveLauC SteveLauC marked this pull request as draft May 5, 2024 12:14
@SteveLauC
Copy link
Member Author

Well, I reproduced issue 2 on my host, both with our MSRV toolchain and the latest stable toolchain 1.78:

$ l ~/.cargo/registry/index
Permissions Links Size User Group Date Modified Name
drwxr-xr-x@     1    - root root   5 May 20:35  index.crates.io-6f17d22bba15001f

@SteveLauC
Copy link
Member Author

This is kinda weird because it didn't happen in the past, and for now, it only happens with our MSRV toolchain.

Still have no idea why this didn't happen in the past, I fixed it by adding sudo to the last step for jobs that run test with sudo.

@@ -26,4 +26,15 @@ fn main() {
netbsdlike: { any(netbsd, openbsd) },
solarish: { any(illumos, solaris) },
}

// Below are Nix's custom cfg values that we need to let the compiler know
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested by new checks added in Rust 1.80:

error: unexpected `cfg` condition name: `linux_android`
    --> src/sys/socket/addr.rs:2403:15
     |
2403 |         #[cfg(linux_android)]
     |               ^^^^^^^^^^^^^
     |
     = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(linux_android)");` to the top of the `build.rs`
     = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

@@ -13,12 +13,7 @@ mod test_errno;
mod test_fcntl;
#[cfg(linux_android)]
mod test_kmod;
#[cfg(any(
freebsdlike,
target_os = "fushsia",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR, this test module was enabled for target fushsia(note it is a typo), it does not exist, and since module mqueue does not exist on Fuchsia, simply remove this line

@@ -13,7 +13,6 @@ use nix::fcntl::{openat2, OpenHow, ResolveFlag};
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x32",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target does not exist, so remove it

@SteveLauC SteveLauC marked this pull request as ready for review May 5, 2024 13:01
@SteveLauC SteveLauC changed the title ci: try fixing ci ci: fix CI by correct wrong cfg value & rm cache with sudo May 5, 2024
@SteveLauC SteveLauC changed the title ci: fix CI by correct wrong cfg value & rm cache with sudo ci: fix CI by correcting wrong cfg value & removing cache with sudo May 5, 2024
@SteveLauC SteveLauC added this pull request to the merge queue May 5, 2024
Merged via the queue into nix-rust:master with commit 047d662 May 5, 2024
36 checks passed
@SteveLauC SteveLauC deleted the fix/ci branch May 5, 2024 13:12
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