Change on-push workflow to run unit tests
This changes workflows to run unit tests for every new commit (including PRs). A new release will only be published if all tests pass on the master branch.
This commit is contained in:
50
.github/workflows/run-tests.yml
vendored
Normal file
50
.github/workflows/run-tests.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
|
||||
name: Run tests
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
run-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ inputs.repository }}
|
||||
ref: ${{ inputs.ref }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.x
|
||||
6.0.x
|
||||
|
||||
- name: Initialize environment
|
||||
run: |
|
||||
mkdir -p ~/".local/share/Daedalic Entertainment GmbH/Barotrauma"
|
||||
|
||||
- name: Run tests
|
||||
continue-on-error: true
|
||||
run: dotnet test LinuxSolution.sln -clp:"ErrorsOnly;Summary" --logger "trx;LogFileName=$PWD/test-results.trx"
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
path: test-results.trx
|
||||
|
||||
- name: Report test results
|
||||
uses: dorny/test-reporter@v1
|
||||
with:
|
||||
name: Test results
|
||||
path: test-results.trx
|
||||
fail-on-error: true
|
||||
reporter: dotnet-trx
|
||||
Reference in New Issue
Block a user