# Example workflow for an LWS SERVER IMPLEMENTATION repository.
#
# Copy this file to .github/workflows/conformance.yml in your server repo. It starts your
# server, then runs the Touchstone conformance harness against it and uploads the report —
# the "one workflow file to get a conformance report on every push" of DESIGN.md Phase 6.
#
# Replace the "Start the server under test" step with however your implementation launches.
name: LWS conformance

on:
  push:
  pull_request:

jobs:
  conformance:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

      - name: Start the server under test
        run: |
          # e.g. docker run -d -p 3000:3000 my-org/my-lws-server:latest
          # Replace with your server's launch command; it must listen on the URL below.
          echo "start your LWS server so it is listening on http://localhost:3000/"

      - name: Wait for the server
        run: |
          for i in $(seq 1 30); do
            curl -sf http://localhost:3000/ >/dev/null && break || sleep 2
          done

      - name: Run LWS conformance
        uses: ebremer/touchstone/.github/actions/lws-conformance@master
        # For a server that authenticates, pass alice's and bob's tokens as secrets and
        # declare the capability; the action hands them to the harness by name only:
        # env:
        #   TOUCHSTONE_TOKEN_ALICE: ${{ secrets.LWS_TOKEN_ALICE }}
        #   TOUCHSTONE_TOKEN_BOB: ${{ secrets.LWS_TOKEN_BOB }}
        with:
          target-url: http://localhost:3000/
          module: all
          # capabilities: Authentication
          fail-on-nonconformance: "true"
