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
|
required: false
|
||||||
type: string
|
type: string
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
jobs:
|
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 on the test PLCs
|
||||||
run-unit-tests:
|
run-unit-tests:
|
||||||
name: 'Run unit tests'
|
name: 'Run tests and documentation'
|
||||||
needs: check-plcs-online
|
needs: check-plcs-online
|
||||||
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
||||||
steps:
|
steps:
|
||||||
@@ -44,58 +29,44 @@ jobs:
|
|||||||
dotnet-version: '6.0.x'
|
dotnet-version: '6.0.x'
|
||||||
|
|
||||||
- name: 'Run tests'
|
- name: 'Run tests'
|
||||||
run: |
|
run: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../Builds/TestResults/coverage.opencover.xml
|
||||||
cd './MewtocolTests'
|
|
||||||
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.opencover.xml
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
- name: Report Generator
|
- name: Report Generator
|
||||||
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22
|
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22
|
||||||
with:
|
with:
|
||||||
reports: './MewtocolTests/TestResults/coverage.opencover.xml'
|
reports: './Builds/TestResults/coverage.opencover.xml'
|
||||||
targetdir: './MewtocolTests/TestResults'
|
targetdir: './Builds/TestResults'
|
||||||
reporttypes: HtmlSummary;MarkdownSummaryGithub;Badges
|
reporttypes: HtmlSummary;MarkdownSummaryGithub;Badges
|
||||||
historydir: './MewtocolTests/Hist'
|
historydir: './Builds/Hist'
|
||||||
title: Report
|
title: Report
|
||||||
|
|
||||||
- name: Markdown report and copy for badges branch
|
- name: Markdown report and copy for badges branch
|
||||||
run: |
|
run: |
|
||||||
cat './MewtocolTests/TestResults/SummaryGithub.md' >> $GITHUB_STEP_SUMMARY
|
cat './Builds/TestResults/SummaryGithub.md' >> $GITHUB_STEP_SUMMARY
|
||||||
cp ./MewtocolTests/TestResults/badge_combined.svg ~/badge_combined.svg
|
cp ./Builds/TestResults/badge_combined.svg ~/badge_combined.svg
|
||||||
cp ./MewtocolTests/TestResults/summary.html ~/summary.html
|
cp ./Builds/TestResults/summary.html ~/summary.html
|
||||||
ls -l ~
|
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
|
- name: Cache test results
|
||||||
if: ${{ github.event_name == 'workflow_call' }}
|
if: ${{ github.event_name == 'workflow_call' }}
|
||||||
uses: actions/cache/save@v3
|
uses: actions/cache/save@v3
|
||||||
with:
|
with:
|
||||||
key: ${{ inputs.cache-id }}
|
key: ${{ inputs.cache-id }}-${{ GITHUB_REF##*/ }}
|
||||||
path: |
|
path: |
|
||||||
${{ github.workspace }}/MewtocolTests/TestResults
|
${{ github.workspace }}/Builds/TestResults
|
||||||
|
|
||||||
- name: Commit badge
|
- name: Commit badge
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
git fetch
|
git fetch
|
||||||
git checkout badges
|
git checkout badges
|
||||||
cp ~/summary.html ./MewtocolTests/TestResults/summary.html
|
cp ~/summary.html ./Builds/TestResults/summary_${{ GITHUB_REF##*/ }}.html
|
||||||
cp ~/badge_combined.svg ./MewtocolTests/TestResults/badge_combined.svg
|
cp ~/badge_combined.svg ./Builds/TestResults/badge_combined_${{ GITHUB_REF##*/ }}.svg
|
||||||
git config --local user.email "action@github.com"
|
git config --local user.email "action@github.com"
|
||||||
git config --local user.name "GitHub Action"
|
git config --local user.name "GitHub Action"
|
||||||
git add "./MewtocolTests/TestResults/badge_combined.svg" -f
|
git add "./Builds/TestResults/badge_combined_${{ GITHUB_REF##*/ }}.svg" -f
|
||||||
git add "./MewtocolTests/TestResults/summary.html" -f
|
git add "./Builds/TestResults/summary_${{ GITHUB_REF##*/ }}.html" -f
|
||||||
git commit -m "Add/Update badge"
|
git commit -m "Add/Update badge for branch ${{ GITHUB_REF##*/ }}"
|
||||||
|
|
||||||
- name: Push badge commit
|
- name: Push badge commit
|
||||||
uses: ad-m/github-push-action@master
|
uses: ad-m/github-push-action@master
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
|
# On commit pipeline
|
||||||
|
|
||||||
## 1. Run the tests
|
## 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`
|
`dotnet publish -c:Release --property WarningLevel=0`
|
||||||
Reference in New Issue
Block a user