actions:
  post-upstream-clone:
    - 'cp dist/libblockdev.spec.in dist/libblockdev.spec'
    - 'sed -i -e "s/@WITH_..*@/1/g" -e "s/@MAJOR_VER@/3/g" dist/libblockdev.spec'
  create-archive:
    - './autogen.sh'
    - './configure'
    - 'make'
    - 'make local'
    - 'bash -c "ls *.tar*"'
  get-current-version:
    - 'bash -c "grep Version: dist/libblockdev.spec.in | cut -f2 -d\":\" | tr -d \" \""'

jobs:
- job: copr_build
  targets:
  - fedora-rawhide-aarch64
  - fedora-rawhide-ppc64le
  - fedora-rawhide-x86_64
  - fedora-latest-aarch64
  - fedora-latest-ppc64le
  - fedora-latest-x86_64
  - fedora-latest-stable-aarch64
  - fedora-latest-stable-ppc64le
  - fedora-latest-stable-x86_64
  trigger: pull_request
  branch: master

- job: copr_build
  targets:
    - centos-stream-10-aarch64
    - centos-stream-10-ppc64le
    - centos-stream-10-x86_64
  trigger: pull_request
  branch: rhel10-branch

- job: copr_build
  trigger: commit
  owner: "@storage"
  project: blivet-daily
  branch: master
  preserve_project: true
  actions:
    post-upstream-clone:
      # bump release to 99 to always be ahead of Fedora builds
      - 'bash -c "sed -i -r \"s/Release:(\s*)\S+/Release:     99%{?dist}/\" dist/libblockdev.spec.in"'
      - 'cp dist/libblockdev.spec.in dist/libblockdev.spec'
      - 'sed -i -e "s/@WITH_..*@/1/g" -e "s/@MAJOR_VER@/3/g" dist/libblockdev.spec'
    create-archive:
      - './autogen.sh'
      - './configure'
      - 'make'
      - 'make local'
      - 'bash -c "ls *.tar*"'
    get-current-version:
      - 'bash -c "grep Version: dist/libblockdev.spec.in | cut -f2 -d\":\" | tr -d \" \""'

- job: copr_build
  trigger: commit
  owner: "@storage"
  project: udisks-daily
  branch: master
  preserve_project: true
  actions:
    post-upstream-clone:
      # bump release to 99 to always be ahead of Fedora builds
      - 'bash -c "sed -i -r \"s/Release:(\s*)\S+/Release:     99%{?dist}/\" dist/libblockdev.spec.in"'
      - 'cp dist/libblockdev.spec.in dist/libblockdev.spec'
      - 'sed -i -e "s/@WITH_..*@/1/g" -e "s/@MAJOR_VER@/3/g" dist/libblockdev.spec'
    create-archive:
      - './autogen.sh'
      - './configure'
      - 'make'
      - 'make local'
      - 'bash -c "ls *.tar*"'
    get-current-version:
      - 'bash -c "grep Version: dist/libblockdev.spec.in | cut -f2 -d\":\" | tr -d \" \""'

- job: propose_downstream
  trigger: release
  dist_git_branches:
    - fedora-development
    - fedora-latest

- job: koji_build
  trigger: commit
  dist_git_branches:
    - fedora-development
    - fedora-latest

- job: bodhi_update
  trigger: commit
  dist_git_branches:
    - fedora-branched

- job: tests
  trigger: pull_request
  targets:
    - fedora-latest-x86_64
    - fedora-latest-aarch64
    - fedora-latest-stable-x86_64
    - fedora-latest-stable-aarch64
  branch: master

- job: tests
  trigger: pull_request
  targets:
    - centos-stream-10-x86_64
  branch: rhel10-branch

# run tests for libblockdev consumers, see plans/ with `revdeps_blivet == yes`
- job: tests
  identifier: revdeps_blivet
  trigger: pull_request
  notifications:
    failure_comment:
      message: "Blivet tests failed for commit {commit_sha}. @vojtechtrefny please check."
  targets:
    - fedora-latest-stable
  branch: master
  tf_extra_params:
    environments:
      - artifacts:
        - type: repository-file
          id: https://copr.fedorainfracloud.org/coprs/g/storage/blivet-daily/repo/fedora-$releasever/group_storage-blivet-daily-fedora-$releasever.repo
        tmt:
          context:
            revdeps_blivet: "yes"

- job: tests
  identifier: revdeps_udisks
  trigger: pull_request
  notifications:
    failure_comment:
      message: "udisks tests failed for commit {commit_sha}. @vojtechtrefny @tbzatek please check."
  targets:
    - fedora-latest-stable
  branch: master
  tf_extra_params:
    environments:
      - artifacts:
        - type: repository-file
          id: https://copr.fedorainfracloud.org/coprs/g/storage/udisks-daily/repo/fedora-$releasever/group_storage-udisks-daily-fedora-$releasever.repo
        tmt:
          context:
            revdeps_udisks: "yes"

srpm_build_deps:
 - make
 - gcc
 - libtool
 - autoconf
 - autoconf-archive
 - automake
 - cryptsetup-devel
 - device-mapper-devel
 - e2fsprogs-devel
 - glib2-devel
 - glib2-doc
 - gobject-introspection-devel
 - gtk-doc
 - json-glib-devel
 - keyutils-libs-devel
 - kmod-devel
 - libatasmart-devel
 - libblkid-devel
 - libbytesize-devel
 - libfdisk-devel
 - libmount-devel
 - libnvme-devel
 - libuuid-devel
 - libyaml-devel
 - ndctl-devel
 - nss-devel
 - parted-devel
 - python3-devel
 - systemd-devel
 - volume_key-devel

downstream_package_name: libblockdev
specfile_path: dist/libblockdev.spec
