Integration Tests #38
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: Integration Tests | |
on: | |
workflow_run: | |
workflows: ["Build"] | |
types: | |
- completed | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.workflow_run.head_sha }} | |
repository: ${{ github.event.workflow_run.repository.full_name }} | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.19' | |
- name: Install dependencies | |
run: go mod download | |
- name: Build | |
run: go build ./... | |
- name: Install gotestsum | |
run: go install gotest.tools/gotestsum@v1.12.0 | |
- name: Run Integration tests | |
run: | | |
gotestsum --format testname --junitfile report.xml -- -v ./test/integration_tests/... | |
env: | |
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }} | |
KEY: ${{ secrets.KEY }} | |
SECRET: ${{ secrets.SECRET }} | |
- name: Set PR Status to Failure | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { owner, repo } = context.repo; | |
const sha = context.payload.workflow_run.head_sha; | |
await github.rest.repos.createCommitStatus({ | |
owner: owner, | |
repo: repo, | |
sha: sha, | |
state: 'failure', | |
context: 'Integration Tests', | |
description: 'Integration tests failed.', | |
}); | |
- name: Set PR Status to Success | |
if: ${{ success() }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { owner, repo } = context.repo; | |
const sha = context.payload.workflow_run.head_sha; | |
await github.rest.repos.createCommitStatus({ | |
owner: owner, | |
repo: repo, | |
sha: sha, | |
state: 'success', | |
context: 'Integration Tests', | |
description: 'Integration tests succeeded.', | |
}); | |
- name: Publish test results | |
if: always() | |
uses: dorny/test-reporter@v1 | |
with: | |
name: Integration tests report | |
path: report.xml | |
reporter: java-junit |