Reference workflow without caching #7
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: Golden_Workflow | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
checks: write | |
contents: read | |
jobs: | |
# Job to build the System Under Test (SUT) | |
build-sut: | |
name: Build SUT | |
runs-on: vtt | |
steps: | |
# check out the repository containing the codebase | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# run DaVinci & vVIRTUALtarget if no cache build is available | |
- name: Run DaVinci & vVIRTUALtarget | |
run: | | |
VttMake make ./ECU/LightControl.vttmake; | |
if(-Not $?) | |
{ | |
Write-Host "VttMake step failed." -ForegroundColor red | |
Exit -1 | |
} | |
# upload the SUT directory as an artifact for use in other jobs | |
- name: Export ECU/SUT | |
uses: actions/upload-artifact@v4 | |
with: | |
name: SUT | |
path: ./ECU/SUT | |
retention-days: 7 | |
# list the contents of the SUT directory to verify the build | |
- name: Check DLL | |
run : ls ECU/SUT/ | |
# Job to build the simulation environment and compile test units | |
build-simulation: | |
name: Build simulation | |
needs: [build-sut] | |
runs-on: canoe-small | |
steps: | |
# check out the repository containing the codebase | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# download the SUT artifact produced by the build-sut job | |
- name: Fetch SUT artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: SUT | |
path: ECU/SUT | |
# create the simulation environment from the venvironment.yaml file | |
- name: Make environment | |
run: | | |
environment-make -o ./compiled-environment-and-tests -A Win32 ./environment-make/venvironment.yaml; | |
# compile the test units for the environment | |
- name: Make test units | |
run: | | |
test-unit-make -e ./compiled-environment-and-tests/Default.venvironment -o ./compiled-environment-and-tests/ ./tests/auto/auto.vtestunit.yaml ./tests/basic/basic.vtestunit.yaml; | |
# upload the compiled environment and test units as an artifact | |
- name: Export compiled-environment-and-tests | |
uses: actions/upload-artifact@v4 | |
with: | |
name: compiled-environment-and-tests | |
path: ./compiled-environment-and-tests/ | |
retention-days: 7 | |
# Job to run the simulation tests | |
run-tests-simulation: | |
name: Run simulation | |
needs: build-simulation | |
runs-on: canoe-large | |
strategy: | |
matrix: | |
TESTNAME: [auto, basic] | |
fail-fast: false | |
steps: | |
# check out the repository containing the codebase | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# download the SUT artifact produced by the build-sut job | |
- name: Fetch SUT artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: SUT | |
path: ECU/SUT | |
# download the compiled environment and tests artifact produced by the build-simulation job | |
- name: Fetch compiled-environment-and-tests artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: compiled-environment-and-tests | |
path: compiled-environment-and-tests | |
# run the CANoe4SW Server Edition with the specified test unit | |
- name: Run CANoe4SW Server Edition | |
id: canoe4swse | |
run: | | |
& canoe4sw-se ./compiled-environment-and-tests/Default.venvironment -d ./simulation --win32 --port-rtk-api none --test-unit ./compiled-environment-and-tests/${{ matrix.TESTNAME }}.vtestunit; | |
Write-Host "CANoe4SW Server Edition returned exit code $LASTEXITCODE" | |
# upload the test reports generated by the simulation | |
- name: Export test reports | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test Reports ${{ matrix.TESTNAME }} | |
path: | | |
./simulation/TestReports/ | |
retention-days: 7 | |
# upload the log files generated by the simulation | |
- name: Upload log files | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Log Files ${{ matrix.TESTNAME }} | |
path: ./simulation/*.txt | |
# Job to display the test report | |
display-test-report: | |
name: Display test report | |
if: ${{ !cancelled() }} | |
needs: run-tests-simulation | |
runs-on: canoe-small | |
steps: | |
# check out the repository containing the codebase | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# download the test report artifact for the 'auto' test | |
- name: Fetch testreport auto artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Test Reports auto | |
path: ./simulation/TestReports/ | |
# download the test report artifact for the 'basic' test | |
- name: Fetch testreport basic artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Test Reports basic | |
path: ./simulation/TestReports/ | |
# convert all test reports to XUnit format | |
- name: Convert all test reports to XUnit format | |
working-directory: ./simulation/TestReports/ | |
run: | | |
get-childitem . -Filter *.vtestreport | foreach { | |
ReportViewerCli -r $_ -xu | |
} | |
# display the test results using the dorny/test-reporter action | |
- name: Display test results | |
uses: dorny/[email protected] | |
with: | |
name: Test results # Name of the check run which will be created | |
path: "./simulation/TestReports/*_xunit.xml" # Path to test results | |
reporter: java-junit # Format of test results |