triggers:
  - action: email
    condition: always
    to: syd-devel <~alip/syd-devel@lists.sr.ht>
image: fedora/latest
arch: x86_64
artifacts:
  - syd-git-x86_64-fedora.tar.xz
  - syd/syd-bench-git-fedora.md
packages:
- attr
- autoconf
- automake
- awk
- cargo
- cbindgen
- check-devel
- clang
- cmake
- diffutils
- glibc-devel.i686
- glibc-static
- golang
- gperf
- hyperfine
- jq
- libcap-devel
- libtool
- openssl
- openssl-devel
- perf
- perl
- perl-FFI-Platypus
- perl-IO-Socket-SSL
- perl-JSON
- podman
- luajit
- python
- ruby
- rubygem-ffi
- rubygem-minitest
- rust
- socat
- strace
- tar
- valgrind
- wget
- yajl-devel
- xz
- xz-static
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
    python -mvenv venv
    source ~/venv/bin/activate
    pip install lief
    pip install pwntools
- make: |
    umask 077
    cd syd
    sed -i -e '/^lto/s/=.*$/= "off"/' Cargo.toml
    env PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" make CARGOFEATS=oci,trusted,uring release
- test: |
    umask 077
    source ~/venv/bin/activate
    cd syd
    TARGET=$(rustc --print=host-tuple)
    chmod 700 target/${TARGET}/release
    env LANDLOCK_CRATE_TEST_ABI=$(./target/${TARGET}/release/syd-lock -A) PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" make CARGOFEATS=oci,trusted,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
    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: |
    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-fedora 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; mv $bin syd-$tag; done
    mv syd/target/release/pandora syd-$tag
    tar --owner=0 --group=0 -cJvpf syd-git-x86_64-fedora.tar.xz ./syd-$tag
