name: Build pipeline on: workflow_dispatch: push: branches: - main - master paths-ignore: - '**.md' 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' needs: check-plcs-online runs-on: [self-hosted, linux, x64, womed-local-linux] strategy: matrix: dotnet-version: [ '6.0.x' ] steps: - uses: actions/checkout@v3 - name: 'Setup dotnet ${{ matrix.dotnet-version }}' uses: actions/setup-dotnet@v2 with: dotnet-version: ${{ matrix.dotnet-version }} - name: 'Run tests' run: | cd '${{ github.workspace }}/MewtocolTests' dotnet test --logger "trx;logfilename=testresults.trx" #Generate a test report - name: 'Generate Test Report' uses: dorny/test-reporter@v1 if: success() || failure() # run this step even if previous step failed with: name: Unit Test Report # Name of the check run which will be created path: '${{ github.workspace }}/MewtocolTests/TestResults/testresults.trx' # Path to test results reporter: dotnet-trx # Format of test results #Run code ql check #code-ql-check: # uses: ./.github/workflows/codeql.yml #Publish to nuget if version tag change detected publish-and-push-nuget: name: 'Build and publish to NuGet' needs: [run-unit-tests, ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 # Publish - name: publish on version change id: publish_nuget uses: brandedoutcast/publish-nuget@v2 with: # Filepath of the project to be packaged, relative to root of repository PROJECT_FILE_PATH: MewtocolNet/MewtocolNet.csproj # Configuration to build and package # BUILD_CONFIGURATION: Release # Platform target to compile (default is empty/AnyCPU) # BUILD_PLATFORM: x64 # NuGet package id, used for version detection & defaults to project name PACKAGE_NAME: Mewtocol.NET # Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH # VERSION_FILE_PATH: Directory.Build.props # Regex pattern to extract version info in a capturing group # VERSION_REGEX: ^\s*(.*)<\/Version>\s*$ # Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX # VERSION_STATIC: 1.0.0 # Flag to toggle git tagging, enabled by default # TAG_COMMIT: true # Format of the git tag, [*] gets replaced with actual version # TAG_FORMAT: v* # API key to authenticate with NuGet server NUGET_KEY: ${{secrets.NUGET_KEY}} # NuGet server uri hosting the packages, defaults to https://api.nuget.org # NUGET_SOURCE: https://api.nuget.org # Flag to toggle pushing symbols along with nuget package to the server, disabled by default # INCLUDE_SYMBOLS: false