Repository: nix-rust/nix (language: rust)

Issue:
Migrate Linux/aarch64 CI tasks to Github Action once the aarch64 runner is available
According to this [post](https://github.blog/changelog/2024-06-03-actions-arm-based-linux-and-windows-runners-are-now-in-public-beta/):

> We expect to begin offering Arm runners for open source and personal accounts by the end of the year.

We should be able to use it in the near future.


Discussion / hints:
It is ready: https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/, we can do the migration now.

Fix patch:
diff --git a/.cirrus.yml b/.cirrus.yml
index 4f4cc76690..4fb70d7b3b 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -64,24 +64,3 @@ task:
     - . $HOME/.cargo/env
     - if [ -z "$NOHACK" ]; then cargo hack check --each-feature --target i686-unknown-freebsd; fi
   before_cache_script: rm -rf $CARGO_HOME/registry/index
-
-# Tasks for Linux aarch64 native builds 
-task:
-  matrix:
-    - name: Linux aarch64 gnu
-      arm_container:
-        image: rust:1.69.0
-        cpu: 1
-      env:
-        TARGET: aarch64-unknown-linux-gnu
-    - name: Linux aarch64 musl
-      arm_container:
-        image: rust:1.69.0
-        cpu: 1
-      env:
-        TARGET: aarch64-unknown-linux-musl
-  setup_script:
-    - rustup target add $TARGET
-    - rustup component add clippy
-  << : *TEST
-  before_cache_script: rm -rf $CARGO_HOME/registry/index
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 956dddd63d..da95038559 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -82,7 +82,7 @@ jobs:
     # would fail on 22.04 and 24.04 (at least for now)
     # https://github.com/nix-rust/nix/issues/2418
     runs-on: ubuntu-20.04
-    needs: [rustfmt, minver, macos, linux_native_builds, rust_stable]
+    needs: [rustfmt, minver, macos, x86_64_linux_native_builds, rust_stable]
     strategy:
       fail-fast: false
       matrix:
@@ -141,9 +141,8 @@ jobs:
 
 
 
-  # Tasks for Linux native builds
-  # Only test x86_64 targets on GitHub Action, leave aarch64 one in Cirrus CI.
-  linux_native_builds:
+  # Tasks for x86_64 Linux native builds
+  x86_64_linux_native_builds:
     runs-on: ubuntu-latest
     strategy:
       fail-fast: false
@@ -178,6 +177,43 @@ jobs:
 
       - name: before_cache_script
         run: sudo rm -rf $CARGO_HOME/registry/index;
+        
+  # Tasks for aarch64 Linux native builds
+  aarch64_linux_native_builds:
+    runs-on: ubuntu-24.04-arm
+    strategy:
+      fail-fast: false
+      matrix:
+        target: [
+          aarch64-unknown-linux-gnu,
+          aarch64-unknown-linux-musl,
+        ]
+
+    steps:
+      - name: checkout
+        uses: actions/checkout@v4
+
+      - name: setup Rust
+        uses: dtolnay/rust-toolchain@master
+        with: 
+          toolchain: '${{ env.MSRV }}'
+          components: clippy
+
+      - name: install targets
+        run: rustup target add ${{ matrix.target }}
+
+      - name: build
+        uses: ./.github/actions/build
+        with:
+          TARGET: '${{ matrix.TARGET }}'
+
+      - name: test
+        uses: ./.github/actions/test
+        with:
+          TARGET: '${{ matrix.TARGET }}'
+
+      - name: before_cache_script
+        run: sudo rm -rf $CARGO_HOME/registry/index;
 
   rust_stable:
     runs-on: ubuntu-latest
@@ -210,7 +246,7 @@ jobs:
   # Tasks for cross-compiling, but no testing
   cross_compiling:
     runs-on: ubuntu-latest
-    needs: [rustfmt, minver, macos, linux_native_builds, rust_stable]
+    needs: [rustfmt, minver, macos, x86_64_linux_native_builds, rust_stable]
     env:
       BUILD: check
     strategy:
@@ -269,7 +305,7 @@ jobs:
 
   redox:
     runs-on: ubuntu-latest
-    needs: [rustfmt, minver, macos, linux_native_builds, rust_stable]
+    needs: [rustfmt, minver, macos, x86_64_linux_native_builds, rust_stable]
     env: 
       TARGET: x86_64-unknown-redox
       CLIPPYFLAGS: -D warnings


Test patch:
diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs
index a5e022dc6e..5a43aab437 100644
--- a/test/sys/test_socket.rs
+++ b/test/sys/test_socket.rs
@@ -917,9 +917,15 @@ pub fn test_scm_rights() {
     close(received_r).unwrap();
 }
 
-// Disable the test on emulated platforms due to not enabled support of AF_ALG in QEMU from rust cross
+// 1. Disable the test on emulated platforms due to not enabled support of
+//    AF_ALG in QEMU from rust cross
+// 2. Disable the test on aarch64/Linux CI because bind() fails with ENOENT
+//    https://github.com/nix-rust/nix/issues/1352
 #[cfg(linux_android)]
-#[cfg_attr(qemu, ignore)]
+#[cfg_attr(
+    any(qemu, all(target_os = "linux", target_arch = "aarch64")),
+    ignore
+)]
 #[test]
 pub fn test_af_alg_cipher() {
     use nix::sys::socket::sockopt::AlgSetKey;
@@ -930,11 +936,6 @@ pub fn test_af_alg_cipher() {
     use nix::unistd::read;
     use std::io::IoSlice;
 
-    skip_if_cirrus!("Fails for an unknown reason Cirrus CI.  Bug #1352");
-    // Travis's seccomp profile blocks AF_ALG
-    // https://docs.docker.com/engine/security/seccomp/
-    skip_if_seccomp!(test_af_alg_cipher);
-
     let alg_type = "skcipher";
     let alg_name = "ctr-aes-aesni";
     // 256-bits secret key