---
name: build
env:
  CI: "true"
  RUSTFLAGS: -D warnings
  RUSTDOCFLAGS: -D warnings
  OMRY_TAG: 0.19.1
on:
  push:
    branches:
      - "*"
jobs:
  build:
    runs-on: docker
    container: 
      image: "archlinux:base-devel"
    steps:
      - name: show-docker-host
        run: env | grep DOCKER_HOST
      - name: refresh-packages
        run: pacman -Sy
      - name: install-packages
        run: >
          pacman -S --noconfirm
          rustup docker docker-buildx cargo-audit cargo-nextest cargo-binstall elvish
          nodejs npm git
      - name: install-rust
        run: rustup toolchain install stable
      - name: checkout
        uses: https://data.forgejo.org/actions/checkout@v4
      - name: fetch-deps
        run: rustup run stable cargo fetch
      - name: audit
        run: cargo audit
      - name: checkout-omry
        run: git clone --depth 1 --branch $OMRY_TAG https://forgejo.e37a.net/flora/omry.git /omry
      - name: push-local-image
        run: |
          cd /omry
          elvish scripts/push_omry_local.elv
      - name: build
        run: cargo build --verbose --all-features
      - name: run-clippy
        run: cargo clippy --all-features --all-targets -- -Wclippy::pedantic -Dwarnings
      - name: run-tests
        run: |
          cargo nextest r --profile=ci --status-level=all --all-features
          cargo test --doc --all-features
      - name: build-docs
        run: cargo doc --no-deps --workspace
      - name: check-style
        run: cargo fmt --check
      - name: cargo-shear
        run: |
          cargo binstall --no-confirm cargo-shear 
          cargo shear
enable-email-notifications: true
