fixed actions/upoad-artifact v2 -> v4 #6
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: Build and Test | |
# PREREQUISITES FOR PUSH-BACK OF TEST RESULTS | |
# Please note: test project usually required nuget package JUnitTestLogger | |
# to be able to provide JUnit compatible test results XML file (required | |
# for pushing back details on succeeded/failed tests) | |
# | |
# NuGet install command: | |
# - Install-Package JUnitTestLogger | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
# Path to the solution file relative to the root of the project | |
SOLUTION_FILE_PATH: . | |
# Configuration type to build | |
BUILD_CONFIGURATION: CI_CD | |
BUILD_OUTPUT: CompuMaster.JitCompilation/bin/CI_CD | |
BUILD_OUTPUT_TEST: CompuMaster.JitCompilation/bin/CI_CD | |
jobs: | |
test: | |
#needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
include: | |
- os: macos-latest | |
runNetExe: mono | |
# the build-and-test job might be skipped, we don't need to run this job then | |
#if: success() || failure() | |
env: | |
RESULTS_PATH: TestResults.xml | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Dir Listing (Win) | |
if: startsWith(matrix.os, 'windows') | |
run: dir | |
- name: Dir Listing (Linux/Mac) | |
if: (!startsWith(matrix.os, 'windows')) | |
run: ls -la | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration=${{env.BUILD_CONFIGURATION}} --no-restore | |
- name: Run Unit Tests | |
run: dotnet test -v n --framework net5.0 --results-directory test-results --logger junit --configuration=${{env.BUILD_CONFIGURATION}} --no-restore | |
- name: Dir Listing (Win) test-results | |
if: startsWith(matrix.os, 'windows') | |
run: dir test-results | |
- name: Dir Listing (Linux/Mac) test-results | |
if: (!startsWith(matrix.os, 'windows')) | |
run: ls -la test-results | |
#Following lines maybe required again after test&dev?! | |
# # the action is useless on pull_request events | |
# # (it can not create check runs or pull request comments) | |
# if: always() #&& startsWith(matrix.os, 'ubuntu') #&& github.event_name != 'pull_request' | |
- name: Unit Test Results (Linux) | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
if: always() && startsWith(matrix.os, 'ubuntu') | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: "test-results/TestResults.xml" | |
check_run_annotations: all tests | |
comment_title: Unit Test Statistics (${{matrix.os}}) | |
check_name: Unit Test Results (${{matrix.os}}) | |
report_individual_runs: true | |
- name: Unit Test Results (Win/Mac) | |
uses: EnricoMi/publish-unit-test-result-action/composite@v1 | |
if: always() && (!(startsWith(matrix.os, 'ubuntu'))) | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
files: "test-results/TestResults.xml" | |
check_run_annotations: all tests | |
comment_title: Unit Test Statistics (${{matrix.os}}) | |
check_name: Unit Test Results (${{matrix.os}}) | |
report_individual_runs: true | |
- name: Publish Unit Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: NUnit Test Results ${{ matrix.os }} | |
path: test-results/TestResults.xml |