name: Decapod Validate

on:
  push:
    branches: [ main, master ]
  pull_request:
    branches: [ main, master ]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
          
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
      - name: Cache Decapod
        uses: actions/cache@v4
        with:
          path: ~/.cargo/bin/decapod
          key: ${{ runner.os }}-decapod
      - name: Install Decapod
        env:
          CARGO_NET_GIT_FETCH_WITH_CLI: "true"
          GIT_TERMINAL_PROMPT: "0"
        run: |
          cargo install --path . --all-features --force
      - name: Decapod Validate
        env:
          DECAPOD_VALIDATE_SKIP_GIT_GATES: 1
        run: |
          decapod init --force --proof
          decapod validate
