windows-test-command #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows tests | |
on: | |
repository_dispatch: | |
types: [windows-test-command] | |
jobs: | |
docker: | |
# At the moment, we are running a self-hosted runner on Windows 2022. | |
runs-on: [self-hosted, Windows, X64] | |
strategy: | |
fail-fast: false | |
timeout-minutes: 30 | |
steps: | |
- name: Create pending status | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.repos.createStatus({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
sha: context.payload.client_payload.pull_request.head.sha, | |
state: 'pending', | |
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`, | |
context: 'Windows tests', | |
}) | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.client_payload.pull_request.head.ref }} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.x | |
id: go | |
- name: modVerify | |
run: go mod verify | |
- name: modTidy | |
run: go mod tidy | |
- name: ensure compilation | |
run: go build | |
- name: go test | |
run: | | |
go install gotest.tools/gotestsum@latest | |
gotestsum --format short-verbose --rerun-fails=5 --packages="./..." --junitfile TEST-unit.xml | |
- name: Create success status | |
uses: actions/[email protected] | |
if: success() | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.repos.createStatus({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
sha: context.payload.client_payload.pull_request.head.sha, | |
state: 'success', | |
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`, | |
context: 'Windows tests', | |
}) | |
- name: Create failure status | |
uses: actions/[email protected] | |
if: failure() | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.repos.createStatus({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
sha: context.payload.client_payload.pull_request.head.sha, | |
state: 'failure', | |
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`, | |
context: 'Windows tests', | |
}) |