1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
|
on:
push:
paths:
- src/**
- audit-specs/**
- syscall-tables/**
- build.rs
- Cargo.*
- .github/workflows/build.yml
- Containerfile
pull_request:
paths:
- src/**
- audit-specs/**
- syscall-tables/**
- build.rs
- Cargo.*
- .github/workflows/build.yml
- Containerfile
jobs:
check-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- run: cargo fmt --check
build-test:
runs-on: ubuntu-latest
container: ubuntu:latest
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
apt-get -qq update
apt-get -qqy dist-upgrade
apt-get -qqy install curl build-essential libclang-dev libacl1-dev libgoogle-perftools-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: "${{ runner.os }}-test-cargo-${{ hashFiles('**/Cargo.lock') }}"
restore-keys: ${{ runner.os }}-test-cargo-
- run: cargo build
- run: cargo test --no-default-features
- run: cargo test
- run: cargo bench --no-run
build-test-old:
runs-on: ubuntu-latest
container: ubuntu:latest
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
apt-get -qq update
apt-get -qqy dist-upgrade
apt-get -qqy install curl build-essential libclang-dev libacl1-dev libgoogle-perftools-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: "1.70"
profile: minimal
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: "${{ runner.os }}-test-cargo-${{ hashFiles('**/Cargo.lock') }}"
restore-keys: ${{ runner.os }}-test-cargo-
- run: cargo test --no-default-features
- run: cargo test
build-x86_64-gnu:
needs: [ check-fmt, build-test ]
runs-on: ubuntu-latest
container: debian:bullseye
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
apt-get -qq update
apt-get -qqy dist-upgrade
apt-get -qqy install curl build-essential libclang-dev libacl1-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: "${{ runner.os }}-x86_64-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}"
restore-keys: ${{ runner.os }}-cargo-x86_64-gnu-
- name: Build
run: cargo build --target=x86_64-unknown-linux-gnu --release
- uses: actions/upload-artifact@v4
with:
name: binaries-x86_64-gnu
path: |
target/*/release/laurel*
!target/*/release/*.*
if-no-files-found: error
build-x86_64-musl:
needs: [ check-fmt, build-test ]
runs-on: ubuntu-latest
container: alpine:3.21
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
apk add git ca-certificates tar rust cargo clang-dev acl-dev acl-static musl-dev linux-headers
apk add binutils file
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: "${{ runner.os }}-x86_64-musl-cargo-${{ hashFiles('**/Cargo.lock') }}"
restore-keys: ${{ runner.os }}-cargo-x86_64-musl-
- name: Build
run: |
RUSTFLAGS='-C target-feature=+crt-static -L/usr/lib -l static=acl' \
cargo build --target x86_64-alpine-linux-musl --release
- name: Show binary charcteristics
run: |
set -x
file target/x86_64-alpine-linux-musl/release/laurel
ldd target/x86_64-alpine-linux-musl/release/laurel
objdump -x target/x86_64-alpine-linux-musl/release/laurel | grep NEEDED || true
set +x
if [ -n "$(objdump -x target/x86_64-alpine-linux-musl/debug/laurel | grep NEEDED)" ]; then
echo "laurel is linked against shared libraries" >&2
exit 1
fi
- uses: actions/upload-artifact@v4
with:
name: binaries-x86_64-musl
path: |
target/*/release/laurel*
!target/*/release/*.*
if-no-files-found: error
build-aarch64-gnu:
needs: [ check-fmt, build-test ]
runs-on: ubuntu-latest
container: debian:bullseye
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
dpkg --add-architecture arm64
apt-get -qq update
apt-get -qqy dist-upgrade
apt-get -qqy install curl build-essential libclang-dev gcc-aarch64-linux-gnu libacl1-dev:arm64
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: aarch64-unknown-linux-gnu
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: "${{ runner.os }}-aarch64-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}"
restore-keys: ${{ runner.os }}-cargo-aarch64-gnu-
- name: Build
run: cargo build --target=aarch64-unknown-linux-gnu --release
- uses: actions/upload-artifact@v4
with:
name: binaries-aarch64-gnu
path: |
target/*/release/laurel*
!target/*/release/*.*
if-no-files-found: error
build-armv7-gnueabihf:
needs: [ check-fmt, build-test ]
runs-on: ubuntu-latest
container: debian:bullseye
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
dpkg --add-architecture armhf
apt-get -qq update
apt-get -qqy dist-upgrade
apt-get -qqy install curl build-essential libclang-dev gcc-arm-linux-gnueabihf libacl1-dev:armhf
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: armv7-unknown-linux-gnueabihf
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: "${{ runner.os }}-armv7-gnueabihf-cargo-${{ hashFiles('**/Cargo.lock') }}"
restore-keys: ${{ runner.os }}-armv7-gnueabihf-cargo-
- name: Build
run: cargo build --target=armv7-unknown-linux-gnueabihf --release
- uses: actions/upload-artifact@v4
with:
name: binaries-armv7-gnueabihf
path: |
target/*/release/laurel*
!target/*/release/*.*
if-no-files-found: error
build-man:
runs-on: ubuntu-latest
container: debian:bullseye
steps:
- uses: actions/checkout@v2
- name: Install dependency
run: |
apt-get -qq update
apt-get -qqy dist-upgrade
apt-get -qqy install make pandoc
- run: make -C man
- uses: actions/upload-artifact@v4
with:
name: manpages
path: |
man/*.7
man/*.8
if-no-files-found: error
build-tarballs:
runs-on: ubuntu-latest
needs:
- build-x86_64-gnu
- build-x86_64-musl
- build-aarch64-gnu
- build-armv7-gnueabihf
- build-man
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts
- name: Collect/Build
run: |
version="$(cargo read-manifest | jq -r '.version')"
find -type f '(' -name laurel2audit -or -name laurel ')'
for arch in x86_64-glibc x86_64-musl aarch64-glibc armv7-glibc; do
tgt=${arch/-glibc/-unknown-linux-gnu}
tgt=${tgt/-musl/-alpine-linux-musl}
case $tgt in armv7*gnu) tgt=${tgt}eabihf ;; esac
mkdir -p pack/laurel-$version-$arch/bin \
pack/laurel-$version-$arch/etc/{audit/plugins.d,laurel} \
pack/laurel-$version-$arch/man/man{7,8} \
pack/laurel-$version-$arch/doc
install -m644 etc/audit/plugins.d/laurel.conf pack/laurel-$version-$arch/etc/audit/plugins.d/
install -m644 etc/laurel/config.toml pack/laurel-$version-$arch/etc/laurel/
install -m644 *.md pack/laurel-$version-$arch/doc/
install -m755 artifacts/$tgt/release/laurel* pack/laurel-$version-$arch/bin
install -m644 artifacts/*.7 pack/laurel-$version-$arch/man/man7/
install -m644 artifacts/*.8 pack/laurel-$version-$arch/man/man8/
done
cd pack
find -mindepth 1 -maxdepth 1 -type d | xargs -ti tar -czf {}.tar.gz {}
- uses: actions/upload-artifact@v4
with:
name: tarballs
path: pack/*.tar.gz
compression-level: 0
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: build-tarballs
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v2
- name: Get Version
id: get_version
run: |
version_git=$(echo "$GITHUB_REF" | sed -e 's/refs\/tags\///')
version_cargo="v$(cargo read-manifest | jq -r '.version')"
if [ "$version_git" != "$version_cargo" ]; then
echo "git != cargo: $version_git != $version_cargo" >&2
exit 1
fi
echo "git_version=$version_git" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: tarballs
- uses: softprops/action-gh-release@v2
with:
files: laurel-*.tar.gz
fail_on_unmatched_files: true
draft: true
build-container:
runs-on: ubuntu-latest
needs:
- build-x86_64-musl
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: target
- name: Edit configuration
run: |
sed -e 's#^input = .*#input = "unix:/var/run/audispd_events"#' etc/laurel/config.toml
- uses: redhat-actions/buildah-build@v2
id: build-image
with:
image: laurel
tags: "latest ${{ github.sha }}"
containerfiles: ./Containerfile
- uses: redhat-actions/podman-login@v1
if: ${{ github.ref_type == 'tag' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: redhat-actions/push-to-registry@v2
if: ${{ github.ref_type == 'tag' }}
with:
registry: ghcr.io/${{ github.repository_owner }}
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
|