bulk 0.4.9

A simple tool for making deb packages, repositories, and update version numbers.
commands:

  make: !Command
    description: Build executable
    container: rust-musl
    run: [cargo, build]

  make-static: !Command
    description: Build executable
    container: rust-musl
    run: [cargo, build, --target=x86_64-unknown-linux-musl]

  test: !Command
    description: Run unit tests
    container: rust-musl
    run: [cargo, test]

  cargo: !Command
    description: Run any cargo command
    container: rust-musl
    run: [cargo]

  bulk: !Command
    description: Run debugging version of bulk
    container: rust-musl
    prerequisites: [make]
    run: [/work/target/debug/bulk]

  package: !Command
    description: Package itself
    container: rust-musl
    prerequisites: [make]
    accepts-arguments: true
    run: |
      rm -rf pkg
      mkdir pkg
      version="$(git describe --dirty)"
      ./target/debug/bulk with-version "$version" \
        cargo build --target=x86_64-unknown-linux-musl --release
      install -D target/x86_64-unknown-linux-musl/release/bulk pkg/usr/bin/bulk
      # pack by itself
      ./target/debug/bulk with-version "$version" \
        /work/pkg/usr/bin/bulk pack --dir ./pkg "$@"

  repo-add: !Command
    description: "Add `*.deb` to test repository in dist/repos"
    container: rust-musl
    prerequisites: [make]
    accepts-arguments: true
    run: |
      target/debug/bulk repo-add \
        --config ./bulk.yaml --repository-base ./dist/repos \
        --replace-existing \
        dist/*.deb "$@"

  get-version: !Command
    description: "Get version of this package (mostly to test bulk)"
    container: rust-musl
    prerequisites: [make]
    run: [target/debug/bulk, get-version]

  check-version: !Command
    description: "Check version of this package (mostly to test bulk)"
    container: rust-musl
    prerequisites: [make]
    run: [target/debug/bulk, check-version]

  set-version: !Command
    description: "Set version of this package (mostly to test bulk)"
    container: rust-musl
    prerequisites: [make]
    run: [target/debug/bulk, set-version]

  with-version: !Command
    description: "Run command with version set (mostly to test bulk)"
    container: rust-musl
    prerequisites: [make]
    run: [target/debug/bulk, with-version]

  _test-trusty: !Command
    container: trusty-install
    write-mode: transient-hard-link-copy
    run: &installtest |
      /usr/bin/bulk --help
      webfsd -r /work/dist/repos -p 7777 &
      apt-get update
      apt-get install -y --allow-unauthenticated bulk
      /usr/bin/bulk --version

  _test-xenial: !Command
    container: xenial-install
    write-mode: transient-hard-link-copy
    run: *installtest

  full-cycle-test: !Command
    description: "Build package, add to repo and install"
    container: rust-musl
    prerequisites: [package, repo-add, _test-trusty, _test-xenial]
    run: [echo, "Done"]

  doc: !Command
    description: Build docs
    container: doc
    work-dir: doc
    run: [make, html]

containers:

  rust-musl:
    environ: &rustenv
      LD_LIBRARY_PATH: /musl/lib/rustlib/x86_64-unknown-linux-musl/lib
      PATH: /musl/bin:/usr/local/bin:/usr/bin:/bin
      HOME: /work/target
    setup:
    - !Ubuntu trusty
    - !UbuntuUniverse
    - !Install [build-essential, ca-certificates, musl-tools, cmake, zlib1g-dev]
    - !TarInstall
      url: "https://static.rust-lang.org/dist/rust-1.18.0-x86_64-unknown-linux-gnu.tar.gz"
      script: "./install.sh --prefix=/usr --components=rustc,rust-std-x86_64-unknown-linux-gnu,cargo"
    - !TarInstall
      url: "https://static.rust-lang.org/dist/rust-std-1.18.0-x86_64-unknown-linux-musl.tar.gz"
      script: "./install.sh --prefix=/musl \
               --components=rust-std-x86_64-unknown-linux-musl"
    - !Sh 'ln -s /musl/lib/rustlib/x86_64-unknown-linux-musl /usr/lib/rustlib/x86_64-unknown-linux-musl'

    # For packaging
    - !Install [git]

  trusty-install:
    setup:
    - !Ubuntu trusty
    - !UbuntuUniverse
    - !Install [webfs]
    - !UbuntuRepo
      url: http://localhost:7777/
      suite: static
      components: [bulk-testing]

  xenial-install:
    setup:
    - !Ubuntu xenial
    - !UbuntuUniverse
    - !Install [webfs]
    - !UbuntuRepo
      url: http://localhost:7777/
      suite: static
      components: [bulk-testing]

  doc:
    setup:
    - !Alpine v3.4
    - !Install [make, python3]
    - !PipConfig { dependencies: true }
    - !Py3Install [sphinx]
    - !Py3Requirements doc/requirements.txt