mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
Added new logic for test pipeline
This commit is contained in:
59
.github/workflows/test-pipeline.yml
vendored
59
.github/workflows/test-pipeline.yml
vendored
@@ -9,30 +9,15 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
permissions: write-all
|
||||
jobs:
|
||||
|
||||
#Check the online status of the test PLCs first
|
||||
check-plcs-online:
|
||||
name: 'Test PLC online status'
|
||||
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
||||
steps:
|
||||
- name: 'Ping FPX-H-C30T'
|
||||
run: ping 192.168.115.210 -w 5
|
||||
- name: 'Ping FPX-H-C14R'
|
||||
run: ping 192.168.115.212 -w 5
|
||||
- name: 'Ping FPX-C30T'
|
||||
run: ping 192.168.115.213 -w 5
|
||||
|
||||
#Run unit tests on the test PLCs
|
||||
run-unit-tests:
|
||||
name: 'Run unit tests'
|
||||
name: 'Run tests and documentation'
|
||||
needs: check-plcs-online
|
||||
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
||||
steps:
|
||||
@@ -44,58 +29,44 @@ jobs:
|
||||
dotnet-version: '6.0.x'
|
||||
|
||||
- name: 'Run tests'
|
||||
run: |
|
||||
cd './MewtocolTests'
|
||||
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.opencover.xml
|
||||
cd ../
|
||||
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../Builds/TestResults/coverage.opencover.xml
|
||||
|
||||
- name: Report Generator
|
||||
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22
|
||||
with:
|
||||
reports: './MewtocolTests/TestResults/coverage.opencover.xml'
|
||||
targetdir: './MewtocolTests/TestResults'
|
||||
reports: './Builds/TestResults/coverage.opencover.xml'
|
||||
targetdir: './Builds/TestResults'
|
||||
reporttypes: HtmlSummary;MarkdownSummaryGithub;Badges
|
||||
historydir: './MewtocolTests/Hist'
|
||||
historydir: './Builds/Hist'
|
||||
title: Report
|
||||
|
||||
- name: Markdown report and copy for badges branch
|
||||
run: |
|
||||
cat './MewtocolTests/TestResults/SummaryGithub.md' >> $GITHUB_STEP_SUMMARY
|
||||
cp ./MewtocolTests/TestResults/badge_combined.svg ~/badge_combined.svg
|
||||
cp ./MewtocolTests/TestResults/summary.html ~/summary.html
|
||||
cat './Builds/TestResults/SummaryGithub.md' >> $GITHUB_STEP_SUMMARY
|
||||
cp ./Builds/TestResults/badge_combined.svg ~/badge_combined.svg
|
||||
cp ./Builds/TestResults/summary.html ~/summary.html
|
||||
ls -l ~
|
||||
|
||||
#Upload to codecov
|
||||
# - name: Upload coverage reports to Codecov
|
||||
# uses: codecov/codecov-action@v3
|
||||
# env:
|
||||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
#- uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: test-results
|
||||
# path: ./MewtocolTests/TestResults/
|
||||
|
||||
- name: Cache test results
|
||||
if: ${{ github.event_name == 'workflow_call' }}
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
key: ${{ inputs.cache-id }}
|
||||
key: ${{ inputs.cache-id }}-${{ GITHUB_REF##*/ }}
|
||||
path: |
|
||||
${{ github.workspace }}/MewtocolTests/TestResults
|
||||
${{ github.workspace }}/Builds/TestResults
|
||||
|
||||
- name: Commit badge
|
||||
continue-on-error: true
|
||||
run: |
|
||||
git fetch
|
||||
git checkout badges
|
||||
cp ~/summary.html ./MewtocolTests/TestResults/summary.html
|
||||
cp ~/badge_combined.svg ./MewtocolTests/TestResults/badge_combined.svg
|
||||
cp ~/summary.html ./Builds/TestResults/summary_${{ GITHUB_REF##*/ }}.html
|
||||
cp ~/badge_combined.svg ./Builds/TestResults/badge_combined_${{ GITHUB_REF##*/ }}.svg
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git add "./MewtocolTests/TestResults/badge_combined.svg" -f
|
||||
git add "./MewtocolTests/TestResults/summary.html" -f
|
||||
git commit -m "Add/Update badge"
|
||||
git add "./Builds/TestResults/badge_combined_${{ GITHUB_REF##*/ }}.svg" -f
|
||||
git add "./Builds/TestResults/summary_${{ GITHUB_REF##*/ }}.html" -f
|
||||
git commit -m "Add/Update badge for branch ${{ GITHUB_REF##*/ }}"
|
||||
|
||||
- name: Push badge commit
|
||||
uses: ad-m/github-push-action@master
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
# On commit pipeline
|
||||
|
||||
## 1. Run the tests
|
||||
|
||||
`dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.opencover.xml`
|
||||
`dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../Builds/TestResults/coverage.opencover.xml`
|
||||
|
||||
## 2. Publish
|
||||
## 2. Run the docs Autobuilder
|
||||
|
||||
`dotnet run --project "./DocBuilder/DocBuilder.csproj"`
|
||||
|
||||
# On publish pipeline
|
||||
|
||||
## 3. Publish
|
||||
|
||||
`dotnet publish -c:Release --property WarningLevel=0`
|
||||
Reference in New Issue
Block a user