Skip to content

Merge pull request #497 from b3b00/bugix/#495 #1052

Merge pull request #497 from b3b00/bugix/#495

Merge pull request #497 from b3b00/bugix/#495 #1052

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- dev
- tech/actions
- master
- feature/implicit-tokens
pull_request:
branches:
- dev
permissions:
pull-requests: write
jobs:
build:
env:
TESTS_PROJECT: 'tests/ParserTests/ParserTests.csproj' # path to test project or solution
PUBLISH_NUGET: true # if true a nuget will be published on version change
RUN_TESTS: true # if true tests are run and coverage data is published to coveralls and a coverage report is produced.
MAIN_CSPROJ: 'src/sly/sly.csproj' # main project (for nuget packaging)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Clean artifacts and nugets
run: dotnet clean --configuration Release && dotnet nuget locals all --clear
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
uses: b3b00/[email protected]
id: 'coverlet'
if: env.RUN_TESTS
with:
testProject: ${{env.TESTS_PROJECT}}
output: 'lcov.net7.0.info'
threshold: 80
outputFormat: 'lcov'
excludes: '[program]*,[expressionParser]*,[jsonparser]*,[while]*,[indentedWhile]*,[SimpleExpressionParser]*,[GenericLexerWithCallbacks]*,[indented]*,[postProcessedLexerParser]*,[XML]*,[SimpleTemplate]*'
- name: coveralls
uses: coverallsapp/[email protected]
if: matrix.os == 'windows-latest' && env.RUN_TESTS
with:
github-token: ${{secrets.GITHUB_TOKEN }}
path-to-lcov: ${{steps.coverlet.outputs.coverageFile}}
#base-path: ${{github.workspace}}
- name: ReportGenerator
uses: danielpalme/[email protected]
with:
reports: ${{steps.coverlet.outputs.coverageFile}}
targetdir: 'coveragereport'
reporttypes: 'HtmlInline;MarkdownSummary'
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
tag: '${{ github.run_number }}_${{ github.run_id }}'
- name: Publish coverage summary
uses: marocchino/sticky-pull-request-comment@v2
with:
path: coveragereport/Summary.md
- name: publish nuget
if: ${{success() && matrix.os == 'windows-latest' && env.PUBLISH_NUGET}}
id: publish_nuget
uses: alirezanet/[email protected]
with:
VERSION_REGEX: <version>(.*)<\/version>
PROJECT_FILE_PATH: ${{env.MAIN_CSPROJ}}
NUGET_KEY: ${{secrets.NUGET_KEY}}
VERSION_FILE_PATH: ${{env.MAIN_CSPROJ}}
INCLUDE_SYMBOLS: true
- name: Create Release
if: ${{ success() && matrix.os == 'windows-latest' && steps.publish_nuget.outputs.VERSION != '' && steps.publish_nuget.outputs.VERSION != null }}
id: create_release
uses: b3b00/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
with:
tag_name: ${{ steps.publish_nuget.outputs.VERSION }}
release_name: Release ${{ steps.publish_nuget.outputs.VERSION }}
draft: false
prerelease: false
failsOnCreationError: false
- name: Upload Release nuget Asset
if: ${{ success() && matrix.os == 'windows-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }}
id: upload-release-nuget-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.publish_nuget.outputs.PACKAGE_PATH }}
asset_name: ${{ steps.publish_nuget.outputs.PACKAGE_NAME }}
asset_content_type: application/zip
- name: Upload Release symbols nuget Asset
if: ${{ success() && matrix.os == 'windows-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }}
id: upload-release-nuget-symbols-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.publish_nuget.outputs.SYMBOLS_PACKAGE_PATH }}
asset_name: ${{ steps.publish_nuget.outputs.SYMBOLS_PACKAGE_NAME }}
asset_content_type: application/zip
# - name: Invoke refresh readme badges
# uses: benc-uk/workflow-dispatch@v1
# with:
# workflow: refresh readme badges
# token: ${{ secrets.RELEASE_PAT }}