name: ci
on: [push, pull_request]
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v4
        with:
          go-version-file: ./go.mod
          cache: true
      - run: COLOR=1 ./make.sh
        env:
          GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }}
          DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: d2chaos
          path: ./d2chaos/out
  nofixups:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: git submodule update --init
      - run: COLOR=1 ./ci/sub/bin/nofixups.sh
        env:
          GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }}
          DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
  signed:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: git submodule update --init
      - run: COLOR=1 ./ci/sub/bin/ensure_signed.sh
        env:
          GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }}
          DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
