From 02fc8e2afb59261ee8b048e35e4933c10eb9701d Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Fri, 24 May 2024 11:24:19 -0300 Subject: [PATCH] ci: test installer on aarch64-linux (#972) * Test the installer on aarch64-linux runners * Remove buildkite reference in step names * Fix build job YAML file path * Use apt install -y * Run only on ARM system * Use apt install -y on ARM machine --- .github/workflows/ci.yml | 117 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa27826e4..5e968531e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,9 @@ jobs: build-x86_64-darwin: uses: ./.github/workflows/build-x86_64-darwin.yml + build-aarch64-linux: + uses: ./.github/workflows/build-aarch64-linux.yml + lints: name: Lints runs-on: ubuntu-latest @@ -56,7 +59,7 @@ jobs: contents: "read" steps: - uses: actions/checkout@v3 - - name: Restore Github cache of Buildkite artifacts + - name: Restore Github cache artifacts uses: actions/cache/restore@v3 with: path: nix-installer @@ -164,7 +167,7 @@ jobs: contents: "read" steps: - uses: actions/checkout@v3 - - name: Restore Github cache of Buildkite artifacts + - name: Restore Github cache artifacts uses: actions/cache/restore@v3 with: path: nix-installer @@ -278,7 +281,7 @@ jobs: contents: "read" steps: - uses: actions/checkout@v3 - - name: Restore Github cache of Buildkite artifacts + - name: Restore Github cache artifacts uses: actions/cache/restore@v3 with: path: nix-installer @@ -351,3 +354,111 @@ jobs: NIX_INSTALLER_LOGGER: pretty NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=debug RUST_BACKTRACE: full + + run-aarch64-linux: + name: Run aarch64 Linux + runs-on: namespace-profile-default-arm64 + needs: [lints, build-aarch64-linux] + permissions: + id-token: "write" + contents: "read" + steps: + - uses: actions/checkout@v3 + - name: Restore Github cache artifacts + uses: actions/cache/restore@v3 + with: + path: nix-installer + key: aarch64-linux-artifacts-${{ github.sha }} + - name: Move & set executable + run: | + mkdir install-root + cp nix-installer.sh install-root/nix-installer.sh + mv ./nix-installer install-root/nix-installer-aarch64-linux + chmod +x install-root/nix-installer-aarch64-linux install-root/nix-installer.sh + - run: sudo apt install -y fish zsh + - name: Initial install + uses: DeterminateSystems/nix-installer-action@main + with: + flakehub: true + local-root: install-root/ + logger: pretty + log-directives: nix_installer=debug + backtrace: full + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Initial uninstall (without a `nix run` first) + run: sudo -E /nix/nix-installer uninstall + env: + NIX_INSTALLER_NO_CONFIRM: true + NIX_INSTALLER_LOGGER: pretty + NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=debug + RUST_BACKTRACE: full + - name: Ensure `nix` is removed + run: | + if systemctl is-active nix-daemon.socket; then + echo "nix-daemon.socket was still running" + exit 1 + fi + if systemctl is-active nix-daemon.service; then + echo "nix-daemon.service was still running" + exit 1 + fi + if [ -e /nix ]; then + echo "/nix exists" + exit 1 + fi + - name: Repeated install + uses: DeterminateSystems/nix-installer-action@main + with: + flakehub: true + local-root: install-root/ + logger: pretty + log-directives: nix_installer=debug + backtrace: full + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: echo $PATH + run: echo $PATH + - name: Test `nix` with `$GITHUB_PATH` + if: success() || failure() + run: | + nix run nixpkgs#hello + nix profile install nixpkgs#hello + hello + nix store gc + nix run nixpkgs#hello + - name: Test bash + run: nix-instantiate -E 'builtins.currentTime' --eval + if: success() || failure() + shell: bash --login {0} + - name: Test sh + run: nix-instantiate -E 'builtins.currentTime' --eval + if: success() || failure() + shell: sh -l {0} + - name: Test zsh + run: nix-instantiate -E 'builtins.currentTime' --eval + if: success() || failure() + shell: zsh --login --interactive {0} + - name: Test fish + run: nix-instantiate -E 'builtins.currentTime' --eval + if: success() || failure() + shell: fish --login {0} + - name: Repeated uninstall + run: sudo -E /nix/nix-installer uninstall + env: + NIX_INSTALLER_NO_CONFIRM: true + NIX_INSTALLER_LOGGER: pretty + NIX_INSTALLER_LOG_DIRECTIVES: nix_installer=debug + RUST_BACKTRACE: full + - name: Ensure `nix` is removed + run: | + if systemctl is-active nix-daemon.socket; then + echo "nix-daemon.socket was still running" + exit 1 + fi + if systemctl is-active nix-daemon.service; then + echo "nix-daemon.service was still running" + exit 1 + fi + if [ -e /nix ]; then + echo "/nix exists" + exit 1 + fi