diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ef7ef93 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,34 @@ +name: Unit tests + +# Manually triggered only - so tests can be run once PR comments are resolved, +# instead of on every push. +# +# Two ways to trigger: +# 1. Add the "run-tests" label to a pull request (re-add it to re-run). +# 2. Actions -> "Unit tests" -> "Run workflow" and pick a branch. +on: + pull_request: + types: [labeled] + workflow_dispatch: + +jobs: + test: + # For the label trigger, only react to the "run-tests" label. + if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'run-tests' + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + + - name: Restore + run: dotnet restore Shoebox.slnx + + - name: Test + run: dotnet test Shoebox.slnx --configuration Release --no-restore