diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4ea797..976b7bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable - name: Configure PAM run: | sudo bash -c 'echo "#%PAM-1.0 @@ -25,7 +28,7 @@ jobs: session requisite pam_permit.so session required pam_permit.so" | tee /etc/pam.d/sr' - name: Install RootAsRole - run: cargo xtask install -d -i -p sudo + run: cargo xtask install -bia - name: Add read access on config on rootasrole... Because Github Actions... run: sudo chmod a+r /etc/security/rootasrole.json - name: print config diff --git a/.github/workflows/pkg.yml b/.github/workflows/pkg.yml index dce81e6..db24834 100644 --- a/.github/workflows/pkg.yml +++ b/.github/workflows/pkg.yml @@ -1,9 +1,10 @@ name: Deploy pkg to GitHub Packages -## only triger manual +## never trigger this workflow automatically on: - workflow_dispatch: - + push: + branches: + - no-trigger jobs: deploy: diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index f051fc9..bc17b09 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -37,13 +37,7 @@ jobs: profile: minimal toolchain: stable components: clippy - override: true - - - name: Install Dependencies - run: ./dependencies.sh -yd - - - name: Configure - run: sudo ./configure.sh -yd + override: false # if pull request review only - uses: mbrobbel/rustfmt-check@master diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0dcb81b..5fae657 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,14 +24,11 @@ jobs: - name: Install sudo run: apt install sudo -y - - name: Install Dependencies - run: ./dependencies.sh -yd - - - name: Install file configuration - run: sudo bash ./configure.sh -yd + - name: Install RootAsRole + run: cargo xtask install -bia - name: run tests with coverage - run: cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --bin chsr --bin sr --exclude-files capable* capable-ebpf/src/vmlinux.rs capable/src/main.rs build.rs --out Xml + run: cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --bin chsr --bin sr --exclude-files build.rs xtask* --out Xml - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 @@ -42,7 +39,7 @@ jobs: flags: unittests - name: run tests with coverage as Admin - run: sudo -E /usr/local/cargo/bin/cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --bin chsr --bin sr --exclude-files capable* capable-ebpf/src/vmlinux.rs capable/src/main.rs build.rs --out Xml + run: sudo -E /usr/local/cargo/bin/cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --bin chsr --bin sr --exclude-files xtask* build.rs --out Xml - name: Upload coverage reports to Codecov as Admin uses: codecov/codecov-action@v3 diff --git a/xtask/src/deploy/debian.rs b/xtask/src/deploy/debian.rs index dbc94f1..e596a3a 100644 --- a/xtask/src/deploy/debian.rs +++ b/xtask/src/deploy/debian.rs @@ -4,13 +4,13 @@ use anyhow::Context; use crate::{ install::{self, dependencies::install_dependencies, InstallDependenciesOptions, Profile}, - util::{get_os, OsTarget}, + util::{detect_priv_bin, get_os, OsTarget}, }; use super::setup_maint_scripts; fn dependencies(os: &OsTarget, priv_bin: Option) -> Result { - install_dependencies(os, &["upx", "dpkg"], priv_bin) + install_dependencies(os, &["upx"], priv_bin) .context("failed to install packaging dependencies") } @@ -21,7 +21,7 @@ pub fn make_deb( ) -> Result<(), anyhow::Error> { let os = get_os(os)?; - dependencies(&os, priv_bin.clone())?; + dependencies(&os, priv_bin.clone().or(detect_priv_bin()))?; install::dependencies(InstallDependenciesOptions { os: Some(os), diff --git a/xtask/src/install/dependencies.rs b/xtask/src/install/dependencies.rs index ae951d2..b067646 100644 --- a/xtask/src/install/dependencies.rs +++ b/xtask/src/install/dependencies.rs @@ -60,7 +60,7 @@ fn get_dependencies(os: &OsTarget, dev: &bool) -> &'static [&'static str] { fn is_priv_bin_necessary(os: &OsTarget) -> Result { match os { - OsTarget::ArchLinux => Ok(geteuid().is_root()), + OsTarget::ArchLinux => Ok(!geteuid().is_root()), _ => { let mut state = CapState::get_current()?; if state.permitted.has(capctl::Cap::DAC_OVERRIDE)