steps:
  backend:
    image: rust
    when:
      event: [push, pull_request, tag, deployment, cron, manual, release]
    environment:
      - GIT_HASH=8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
      - COMPILED_DATE=2021-07-21
    commands:
      - rustup component add rustfmt
      - rustup component add clippy
      - make check
      - make lint
      - make
      - make test

  build-docker-img:
    image: woodpeckerci/plugin-docker-buildx
    when:
      event: [pull_request]
    settings:
      dry_run: true
      repo: realaravinth/libmedium
      username: realaravinth
      platforms: linux/amd64,linux/arm64/v8
      tag: latest


  publish-docker-img:
    image: woodpeckerci/plugin-docker-buildx
    when:
      event: [push, tag, deployment]
      branch: master
    settings:
      repo: realaravinth/libmedium
      username: realaravinth
      password:
        from_secret: DOCKER_TOKEN
      platforms: linux/amd64,linux/arm64/v8
      tag: latest