name: "CI"
on:
  pull_request:
  push:

jobs:
  check-proto:
    runs-on: nix
    steps:
      - uses: actions/checkout@v4
      - uses: https://codeberg.org/icewind/attic-action@v1
        with:
          name: link
          instance: https://cache.icewind.link
          authToken: "${{ secrets.ATTIC_TOKEN }}"
      - run: |
          nix run .#proto-builder steam/protos steam/src/generated
      - run: |
          git diff
          git diff-index --quiet HEAD --

  checks:
    runs-on: nix
    steps:
      - uses: actions/checkout@v4
      - uses: https://codeberg.org/icewind/attic-action@v1
        with:
          name: link
          instance: https://cache.icewind.link
          authToken: "${{ secrets.ATTIC_TOKEN }}"
      - run: nix flake check --keep-going

  semver:
    runs-on: nix
    needs: checks
    steps:
      - uses: actions/checkout@v4
      - uses: https://codeberg.org/icewind/attic-action@v1
        with:
          name: ci
          instance: https://cache.icewind.me
          authToken: "${{ secrets.ATTIC_TOKEN }}"
      - name: Check steam-vent-proto
        run: nix run .#semver-checks
      - name: Check steam-vent-proto-common
        working-directory: ./common
        run: nix run .#semver-checks
      - name: Check steam-vent-proto-steam
        working-directory: ./steam
        run: nix run .#semver-checks
