---
name: CI checks

on: push

jobs:
  cargo-lint:
    uses: Cosmian/reusable_workflows/.github/workflows/cargo-lint.yml@develop
    with:
      toolchain: stable
  cargo-semver:
    uses: Cosmian/reusable_workflows/.github/workflows/cargo-semver.yml@develop
  cargo-dry-publish:
    uses: Cosmian/reusable_workflows/.github/workflows/cargo-publish.yml@develop
    with:
      toolchain: stable
      publish: false
  wasm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: wasm32-unknown-unknown
          override: true
      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --verbose --target wasm32-unknown-unknown
  hack:
    runs-on: ubuntu-latest
    steps:
      - name: Check storage
        run: df -h
      - uses: actions/checkout@v1
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - name: Install cargo-hack
        run: cargo install --locked cargo-hack || true
      - name: Test all feature combinations
        uses: actions-rs/cargo@v1
        with:
          command: hack
          args: check --feature-powerset --clean-per-run --no-dev-deps
  cargo-publish:
    needs:
      - cargo-lint
      - cargo-semver
      - cargo-dry-publish
      - wasm
      - hack
    uses: Cosmian/reusable_workflows/.github/workflows/cargo-publish.yml@develop
    if: startsWith(github.ref, 'refs/tags/')
    with:
      toolchain: stable
    secrets: inherit
