triggers:
  - action: email
    condition: always
    to: syd-devel <~alip/syd-devel@lists.sr.ht>
image: alpine/latest
arch: x86_64
artifacts:
  - syd-git-x86_64-alpine.tar.xz
  - syd/syd-bench-git-alpine.md
packages:
- autoconf
- automake
- cargo
- cargo-auditable
- cbindgen
- check-dev
- cmake
- coreutils
- gawk
- gettext
- gettext-dev
- gperf
- hyperfine
- iproute2
- iptables
- jq
- libcap-dev
- libtool
- linux-headers
- luajit
- openssl
- openssl-dev
- perf
- podman
- procps
- python3-dev
- py3-pip
- sed
- socat
- strace
- util-linux-misc
- valgrind
- xz
- yajl-dev
- zlib-dev
sources:
- https://git.sr.ht/~alip/syd
tasks:
- init: |
    uname -a
- scmp: |
    cd syd
    sudo dev/install_libseccomp.sh -i /usr -v main
- pwn: |
    umask 077
    python3 -mvenv venv
    source ~/venv/bin/activate
    pip install lief
    pip install pwntools
- make: |
    umask 077
    cd syd
    env RUSTFLAGS="-g -Ctarget-cpu=x86-64-v2 -Ctarget-feature=+crt-static" make CARGOFEATS=uring release
- test: |
    umask 077
    TARGET=$(rustc --print=host-tuple)
    cd syd
    chmod 700 target/${TARGET}/release
    source ~/venv/bin/activate
    LANDLOCK_CRATE_TEST_ABI=$(./target/${TARGET}/release/syd-lock -A || true)
    env LANDLOCK_CRATE_TEST_ABI=${LANDLOCK_CRATE_TEST_ABI} make CARGOFEATS=uring distcheck
- root: |
    TARGET=$(rustc --print=host-tuple)
    sudo chown -R root:root .
    sudo env TARGET=${TARGET} bash -c 'cd syd; umask 077; env PATH=$(readlink -f .)/target/${TARGET}/release:$PATH syd-test 0_'
    sudo chown -R build:build .
- libc: |
    umask 077
    cd syd
    make lib
- pandora: |
    cd syd/pandora
    make
- pandora_test: |
    TARGET=$(rustc --print=host-tuple)
    umask 077
    cd syd
    chmod -R go-rwx pandora/t
    env PATH=$(readlink -f .)/target/${TARGET}/release:$PATH make pandoracheck
- runsc: |
    cd syd
    dev/install_gvisor.sh
- bench: |
    TARGET=$(rustc --print=host-tuple)
    cd syd
    env SYD_BENCH_OUT=syd-bench-git-alpine SYD_BENCH_SHOW_OUTPUT=1 PATH=$PWD/target/${TARGET}/release:$PATH dev/syd-bench.bash git
- tar: |
    TARGET=$(rustc --print=host-tuple)
    tag=$(cd syd; git describe)
    mkdir syd-$tag
    for bin in $(find syd/target/${TARGET}/release -mindepth 1 -maxdepth 1 -type f -executable -name 'syd*'); do chmod 755 $bin; strip $bin; sudo mv $bin syd-$tag; done
    mv syd/target/release/pandora syd-$tag
    tar --owner=0 --group=0 -cJvpf syd-git-x86_64-alpine.tar.xz ./syd-$tag
