triggers:
  - action: email
    condition: always
    to: syd-devel <~alip/syd-devel@lists.sr.ht>
image: debian/stable
arch: amd64
artifacts:
  - syd-git-x86_64-debian.tar.xz
  - syd/syd-bench-git-debian.md
packages:
- attr
- autoconf
- automake
- binutils-i686-linux-gnu
- build-essential
- cbindgen
- check
- cmake
- cpanminus
- file
- g++-multilib
- gawk
- gcc-multilib
- gettext
- golang
- gperf
- hyperfine
- iptables
- jq
- libcap-dev
- libio-socket-ssl-perl
- libssl-dev
- libyajl-dev
- libtool
- linux-perf
- openssl
- pkg-config
- luajit
- python-is-python3
- python3-venv
- ruby
- ruby-ffi
- socat
- strace
- valgrind
- wget
- zlib1g-dev
sources:
- https://git.sr.ht/~alip/syd
tasks:
- hack: |
    sudo apt install gcc-multilib -y
    sudo apt install g++-multilib -y
    sudo apt install gcc-i686-linux-gnu -y
    sudo apt install g++-multilib-i686-linux-gnu -y
- init: |
    uname -a
- scmp: |
    cd syd
    sudo dev/install_libseccomp.sh -i /usr -v main
- scmp32: |
    cd syd
    sudo env LDFLAGS="-L/usr/i686-linux-gnu/lib" CFLAGS="-m32" LD=i686-linux-gnu-ld CC=i686-linux-gnu-gcc dev/install_libseccomp.sh -v main -i /usr/i686-linux-gnu
- perl: |
    sudo cpanm --force -n FFI::Platypus JSON
- pwn: |
    umask 077
    python3 -mvenv venv
    source ~/venv/bin/activate
    pip install lief
    pip install pwntools
- rust: |
    umask 077
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh
    chmod +x rustup.sh
    ./rustup.sh --profile minimal -y
    source ~/.cargo/env
    rustup target add i686-unknown-linux-gnu
    rustc --version
    rustc --print cfg
    cargo install --locked cargo-auditable
    cargo install --locked cargo-deny
- deny: |
    source ~/.cargo/env
    cd syd
    make deny
- make: |
    umask 077
    source ~/.cargo/env
    cd syd
    sed -i -e '/^lto/s/=.*$/= "off"/' Cargo.toml
    make CARGOFEATS=oci,uring release
- make32: |
    umask 077
    source ~/.cargo/env
    TARGET=$(rustc --print=host-tuple)
    cd syd
    env LDFLAGS="-L/usr/i686-linux-gnu/lib" CFLAGS="-m32" LD=i686-linux-gnu-ld CC=i686-linux-gnu-gcc LIBSECCOMP_LINK_TYPE=static LD_LIBRARY_PATH=/usr/i686-linux-gnu/lib LIBSECCOMP_LIB_PATH=/usr/i686-linux-gnu/lib RUSTFLAGS="-Ctarget-feature=+crt-static" cargo build --target=i686-unknown-linux-gnu --release -j$(nproc) -vv --features asm,log,sh,uring,utils --no-default-features
    mv target/i686-unknown-linux-gnu/release/syd target/${TARGET}/release/syd32
    mv target/i686-unknown-linux-gnu/release/syd-aes target/${TARGET}/release/syd-aes32
    mv target/i686-unknown-linux-gnu/release/syd-asm target/${TARGET}/release/syd-asm32
    mv target/i686-unknown-linux-gnu/release/syd-aux target/${TARGET}/release/syd-aux32
    mv target/i686-unknown-linux-gnu/release/syd-bit target/${TARGET}/release/syd-bit32
    mv target/i686-unknown-linux-gnu/release/syd-cap target/${TARGET}/release/syd-cap32
    mv target/i686-unknown-linux-gnu/release/syd-cat target/${TARGET}/release/syd-cat32
    mv target/i686-unknown-linux-gnu/release/syd-cpu target/${TARGET}/release/syd-cpu32
    mv target/i686-unknown-linux-gnu/release/syd-dns target/${TARGET}/release/syd-dns32
    mv target/i686-unknown-linux-gnu/release/syd-elf target/${TARGET}/release/syd-elf32
    mv target/i686-unknown-linux-gnu/release/syd-emacs target/${TARGET}/release/syd-emacs32
    mv target/i686-unknown-linux-gnu/release/syd-env target/${TARGET}/release/syd-env32
    mv target/i686-unknown-linux-gnu/release/syd-exec target/${TARGET}/release/syd-exec32
    mv target/i686-unknown-linux-gnu/release/syd-fd target/${TARGET}/release/syd-fd32
    mv target/i686-unknown-linux-gnu/release/syd-fork target/${TARGET}/release/syd-fork32
    mv target/i686-unknown-linux-gnu/release/syd-hex target/${TARGET}/release/syd-hex32
    mv target/i686-unknown-linux-gnu/release/syd-info target/${TARGET}/release/syd-info32
    mv target/i686-unknown-linux-gnu/release/syd-key target/${TARGET}/release/syd-key32
    mv target/i686-unknown-linux-gnu/release/syd-ldd target/${TARGET}/release/syd-ldd32
    mv target/i686-unknown-linux-gnu/release/syd-lock target/${TARGET}/release/syd-lock32
    mv target/i686-unknown-linux-gnu/release/syd-ls target/${TARGET}/release/syd-ls32
    mv target/i686-unknown-linux-gnu/release/syd-mdwe target/${TARGET}/release/syd-mdwe32
    mv target/i686-unknown-linux-gnu/release/syd-mem target/${TARGET}/release/syd-mem32
    mv target/i686-unknown-linux-gnu/release/syd-net target/${TARGET}/release/syd-net32
    mv target/i686-unknown-linux-gnu/release/syd-ofd target/${TARGET}/release/syd-ofd32
    mv target/i686-unknown-linux-gnu/release/syd-path target/${TARGET}/release/syd-path32
    mv target/i686-unknown-linux-gnu/release/syd-pause target/${TARGET}/release/syd-pause32
    mv target/i686-unknown-linux-gnu/release/syd-poc target/${TARGET}/release/syd-poc32
    mv target/i686-unknown-linux-gnu/release/syd-pds target/${TARGET}/release/syd-pds32
    mv target/i686-unknown-linux-gnu/release/syd-pty target/${TARGET}/release/syd-pty32
    mv target/i686-unknown-linux-gnu/release/syd-read target/${TARGET}/release/syd-read32
    mv target/i686-unknown-linux-gnu/release/syd-rnd target/${TARGET}/release/syd-rnd32
    mv target/i686-unknown-linux-gnu/release/syd-run target/${TARGET}/release/syd-run32
    mv target/i686-unknown-linux-gnu/release/syd-sec target/${TARGET}/release/syd-sec32
    mv target/i686-unknown-linux-gnu/release/syd-sh target/${TARGET}/release/syd-sh32
    mv target/i686-unknown-linux-gnu/release/syd-size target/${TARGET}/release/syd-size32
    mv target/i686-unknown-linux-gnu/release/syd-stat target/${TARGET}/release/syd-stat32
    mv target/i686-unknown-linux-gnu/release/syd-sum target/${TARGET}/release/syd-sum32
    mv target/i686-unknown-linux-gnu/release/syd-sys target/${TARGET}/release/syd-sys32
    mv target/i686-unknown-linux-gnu/release/syd-test target/${TARGET}/release/syd-test32
    mv target/i686-unknown-linux-gnu/release/syd-test-do target/${TARGET}/release/syd-test-do32
    mv target/i686-unknown-linux-gnu/release/syd-tck target/${TARGET}/release/syd-tck32
    mv target/i686-unknown-linux-gnu/release/syd-tor target/${TARGET}/release/syd-tor32
    mv target/i686-unknown-linux-gnu/release/syd-tty target/${TARGET}/release/syd-tty32
    mv target/i686-unknown-linux-gnu/release/syd-utc target/${TARGET}/release/syd-utc32
    mv target/i686-unknown-linux-gnu/release/syd-uts target/${TARGET}/release/syd-uts32
    mv target/i686-unknown-linux-gnu/release/syd-x target/${TARGET}/release/syd-x32
- test: |
    umask 077
    source ~/.cargo/env
    source ~/venv/bin/activate
    TARGET=$(rustc --print=host-tuple)
    cd syd
    chmod 700 target/${TARGET}/release
    env LANDLOCK_CRATE_TEST_ABI=$(./target/${TARGET}/release/syd-lock -A) make CARGOFEATS=oci,uring distcheck
- root: |
    source ~/.cargo/env
    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 .
- test32:
    umask 077
    source ~/.cargo/env
    source ~/venv/bin/activate
    TARGET=$(rustc --print=host-tuple)
    cd syd
    chmod 700 target/${TARGET}/release
    env LANDLOCK_CRATE_TEST_ABI=$(./target/${TARGET}/release/syd-lock -A) LDFLAGS="-L/usr/i686-linux-gnu/lib" CFLAGS="-m32" LD=i686-linux-gnu-ld CC=i686-linux-gnu-gcc LIBSECCOMP_LINK_TYPE=static LD_LIBRARY_PATH=/usr/i686-linux-gnu/lib LIBSECCOMP_LIB_PATH=/usr/i686-linux-gnu/lib RUSTFLAGS="-Ctarget-feature=+crt-static" ./dev/cargo-test.sh --target=i686-unknown-linux-gnu --release -j$(nproc) -vv --features uring
- test64_32: |
    umask 077
    source ~/.cargo/env
    source ~/venv/bin/activate
    TARGET=$(rustc --print=host-tuple)
    cd syd
    chmod 700 target/${TARGET}/release
    env LANDLOCK_CRATE_TEST_ABI=$(./target/${TARGET}/release/syd-lock -A) CARGO_BIN_EXE_syd=$PWD/target/${TARGET}/release/syd CARGO_BIN_EXE_syd-aux=$PWD/target/${TARGET}/release/syd-aux32 CARGO_BIN_EXE_syd-bit=$PWD/target/${TARGET}/release/syd-bit32 CARGO_BIN_EXE_syd-cap=$PWD/target/${TARGET}/release/syd-cap32 CARGO_BIN_EXE_syd-dns=$PWD/target/${TARGET}/release/syd-dns32 CARGO_BIN_EXE_syd-aes=$PWD/target/${TARGET}/release/syd-aes32 CARGO_BIN_EXE_syd-key=$PWD/target/${TARGET}/release/syd-key32 CARGO_BIN_EXE_syd-exec=$PWD/target/${TARGET}/release/syd-exec32 CARGO_BIN_EXE_syd-elf=$PWD/target/${TARGET}/release/syd-elf32 CARGO_BIN_EXE_syd-env=$PWD/target/${TARGET}/release/syd-env32  CARGO_BIN_EXE_syd-test-do=$PWD/target/${TARGET}/release/syd-test-do32 CARGO_BIN_EXE_syd-cpu=$PWD/target/${TARGET}/release/syd-cpu32 CARGO_BIN_EXE_syd-hex=$PWD/target/${TARGET}/release/syd-hex32 CARGO_BIN_EXE_syd-info=$PWD/target/${TARGET}/release/syd-info32 CARGO_BIN_EXE_syd-lock=$PWD/target/${TARGET}/release/syd-lock32 CARGO_BIN_EXE_syd-mdwe=$PWD/target/${TARGET}/release/syd-mdwe32 CARGO_BIN_EXE_syd-ofd=$PWD/target/${TARGET}/release/syd-ofd32 CARGO_BIN_EXE_syd-pause=$PWD/target/${TARGET}/release/syd-pause32 CARGO_BIN_EXE_syd-pds=$PWD/target/${TARGET}/release/syd-pds32 CARGO_BIN_EXE_syd-sec=$PWD/target/${TARGET}/release/syd-sec32 CARGO_BIN_EXE_syd-size=$PWD/target/${TARGET}/release/syd-size32 CARGO_BIN_EXE_syd-uts=$PWD/target/${TARGET}/release/syd-uts32 CARGO_BIN_EXE_syd-x=$PWD/target/${TARGET}/release/syd-x32 ./target/${TARGET}/release/syd-test32
- libc: |
    umask 077
    source ~/.cargo/env
    TARGET=$(rustc --print=host-tuple)
    cd syd
    make lib
    env PATH="${PWD}/target/${TARGET}/release:${PATH}" CGO_LDFLAGS="-L${PWD}/target/${TARGET}/release/deps" make checklib
- pandora: |
    source ~/.cargo/env
    cd syd/pandora
    make
- pandora_test: |
    umask 077
    source ~/.cargo/env
    TARGET=$(rustc --print=host-tuple)
    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: |
    source ~/.cargo/env
    TARGET=$(rustc --print=host-tuple)
    cd syd
    env SYD_BENCH_OUT=syd-bench-git-debian SYD_BENCH_SHOW_OUTPUT=1 PATH=$PWD/target/${TARGET}/release:$PATH dev/syd-bench.bash git
- tar: |
    source ~/.cargo/env
    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; mv $bin syd-$tag; done
    mv syd/target/release/pandora syd-$tag
    tar --owner=0 --group=0 -cJvpf syd-git-x86_64-debian.tar.xz ./syd-$tag
