forked from lix-project/lix-installer
Merge pull request #42 from DeterminateSystems/hoverbear/ds-427-add-ci-jobs-to-do-install-uninstall
Add new CI jobs that test install/uninstall
This commit is contained in:
commit
8b3205e944
54
.github/workflows/ci.yml
vendored
54
.github/workflows/ci.yml
vendored
|
@ -82,6 +82,33 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
result/bin/harmonic
|
result/bin/harmonic
|
||||||
|
|
||||||
|
RunX86Linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: BuildX86Linux
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: harmonic-x86_64-linux
|
||||||
|
- name: Set executable
|
||||||
|
run: chmod +x ./harmonic
|
||||||
|
- name: Initial install
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm
|
||||||
|
- name: Test run
|
||||||
|
run: |
|
||||||
|
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||||
|
nix run nixpkgs#fortune
|
||||||
|
- name: Initial uninstall
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||||
|
- name: Repeated install
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm
|
||||||
|
- name: Repeated test run
|
||||||
|
run: |
|
||||||
|
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||||
|
nix run nixpkgs#fortune
|
||||||
|
- name: Repeated uninstall
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||||
|
|
||||||
|
|
||||||
BuildX86Darwin:
|
BuildX86Darwin:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -99,3 +126,30 @@ jobs:
|
||||||
name: harmonic-x86_64-darwin
|
name: harmonic-x86_64-darwin
|
||||||
path: |
|
path: |
|
||||||
result/bin/harmonic
|
result/bin/harmonic
|
||||||
|
|
||||||
|
RunX86Darwin:
|
||||||
|
runs-on: macos-latest
|
||||||
|
needs: BuildX86Darwin
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: harmonic-x86_64-darwin
|
||||||
|
- name: Set executable
|
||||||
|
run: chmod +x ./harmonic
|
||||||
|
- name: Initial install
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm
|
||||||
|
- name: Test run
|
||||||
|
run: |
|
||||||
|
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||||
|
nix run nixpkgs#fortune
|
||||||
|
- name: Initial uninstall
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||||
|
- name: Repeated install
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm
|
||||||
|
- name: Repeated test run
|
||||||
|
run: |
|
||||||
|
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||||
|
nix run nixpkgs#fortune
|
||||||
|
- name: Repeated uninstall
|
||||||
|
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
||||||
|
|
|
@ -132,6 +132,15 @@ impl Action for ConfigureNixDaemonService {
|
||||||
execute_command(Command::new("systemctl").arg("daemon-reload"))
|
execute_command(Command::new("systemctl").arg("daemon-reload"))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
||||||
|
|
||||||
|
execute_command(
|
||||||
|
Command::new("systemctl")
|
||||||
|
.arg("enable")
|
||||||
|
.arg("--now")
|
||||||
|
.arg("nix-daemon.socket"),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,11 +190,11 @@ impl Action for ConfigureNixDaemonService {
|
||||||
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
execute_command(Command::new("systemctl").args(["disable", SOCKET_SRC]))
|
execute_command(Command::new("systemctl").args(["disable", SOCKET_SRC, "--now"]))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
||||||
|
|
||||||
execute_command(Command::new("systemctl").args(["disable", SERVICE_SRC]))
|
execute_command(Command::new("systemctl").args(["disable", SERVICE_SRC, "--now"]))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
.map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?;
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,13 @@ impl Action for StartSystemdUnit {
|
||||||
tracing::debug!("Stopping systemd unit");
|
tracing::debug!("Stopping systemd unit");
|
||||||
|
|
||||||
// TODO(@Hoverbear): Handle proxy vars
|
// TODO(@Hoverbear): Handle proxy vars
|
||||||
execute_command(Command::new("systemctl").arg("stop").arg(format!("{unit}")))
|
execute_command(
|
||||||
.await
|
Command::new("systemctl")
|
||||||
.map_err(|e| StartSystemdUnitError::Command(e).boxed())?;
|
.arg("disable")
|
||||||
|
.arg(format!("{unit}")),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map_err(|e| StartSystemdUnitError::Command(e).boxed())?;
|
||||||
|
|
||||||
tracing::trace!("Stopped systemd unit");
|
tracing::trace!("Stopped systemd unit");
|
||||||
*action_state = ActionState::Completed;
|
*action_state = ActionState::Completed;
|
||||||
|
|
|
@ -60,11 +60,16 @@ impl CommandExecute for Install {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(err) = plan.install().await {
|
if let Err(err) = plan.install().await {
|
||||||
tracing::error!("{:?}", eyre!(err));
|
let error = eyre!(err).wrap_err("Install failure");
|
||||||
if !interaction::confirm(plan.describe_revert(explain)).await? {
|
if !no_confirm {
|
||||||
interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await;
|
tracing::error!("{:?}", error);
|
||||||
|
if !interaction::confirm(plan.describe_revert(explain)).await? {
|
||||||
|
interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await;
|
||||||
|
}
|
||||||
|
plan.revert().await?
|
||||||
|
} else {
|
||||||
|
return Err(error);
|
||||||
}
|
}
|
||||||
plan.revert().await?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ExitCode::SUCCESS)
|
Ok(ExitCode::SUCCESS)
|
||||||
|
|
|
@ -31,7 +31,6 @@ impl Planner for LinuxMulti {
|
||||||
Box::new(CreateDirectory::plan("/nix", None, None, 0o0755, true).await?),
|
Box::new(CreateDirectory::plan("/nix", None, None, 0o0755, true).await?),
|
||||||
Box::new(ProvisionNix::plan(self.settings.clone()).await?),
|
Box::new(ProvisionNix::plan(self.settings.clone()).await?),
|
||||||
Box::new(ConfigureNix::plan(self.settings).await?),
|
Box::new(ConfigureNix::plan(self.settings).await?),
|
||||||
Box::new(StartSystemdUnit::plan("nix-daemon.socket".into()).await?),
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue