Update build.yml #68
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: .NET Core | ||
on: [push, pull_request, workflow_dispatch] | ||
jobs: | ||
build: | ||
env: | ||
TESTS_PROJECT: 'SharpFileSystem.Tests/SharpFileSystem.Tests.csproj' # path to test project or solution | ||
RUN_TESTS: true # if true tests are run and coverage data is published to coveralls and a coverage report is produced. | ||
MAIN_CSPROJ: 'SharpCoreFileSystem/SharpCoreFileSystem.csproj' # main project (for nuget packaging) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
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/coverlet-action@1.2.2 | ||
id: 'coverlet' | ||
if: env.RUN_TESTS | ||
with: | ||
testProject: ${{env.TESTS_PROJECT}} | ||
output: 'lcov.info' | ||
outputFormat: 'lcov' | ||
threshold: 25 | ||
excludes: '[TestSFS]*,[SharpFileSystem.Tests]*,[SharFileSystem.SevenZip]*' | ||
- name: coveralls | ||
uses: coverallsapp/github-action@v1.1.1 | ||
if: matrix.os == 'windows-latest' && env.RUN_TESTS | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN }} | ||
path-to-lcov: ${{steps.coverlet.outputs.coverageFile}} | ||
- name: ReportGenerator | ||
uses: danielpalme/ReportGenerator-GitHub-Action@4.8.4 | ||
with: | ||
reports: ${{steps.coverlet.outputs.coverageFile}} | ||
targetdir: 'coveragereport' | ||
reporttypes: 'HtmlInline;lcov' | ||
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off | ||
tag: '${{ github.run_number }}_${{ github.run_id }}' | ||
- name: publish nuget | ||
if: matrix.os == 'windows-latest' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
id: publish_nuget | ||
uses: b3b00/publish-nuget@1.1.2 | ||
with: | ||
VERSION_REGEX: <version>(.*)<\/version> | ||
PROJECT_FILE_PATH: ${{env.MAIN_CSPROJ}} | ||
NUGET_KEY: ${{secrets.NUGET_KEY}} | ||
VERSION_FILE_PATH: ${{env.MAIN_CSPROJ}} | ||
- name: Create Release | ||
if: ${{ success() && matrix.os == 'ubuntu-latest' && steps.publish_nuget.outputs.VERSION != '' && steps.publish_nuget.outputs.VERSION != null }} | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.publish_nuget.outputs.VERSION }} | ||
release_name: Release ${{ steps.publish_nuget.outputs.VERSION }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
if: ${{ success() && matrix.os == 'ubuntu-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }} | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
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: Invoke refresh readme badges | ||
if: ${{ contains(github.ref, 'master') && && matrix.os == 'ubuntu-latest' && steps.create_release.outputs.upload_url != '' && steps.create_release.outputs.upload_url != null }} | ||
Check failure on line 80 in .github/workflows/build.yml GitHub Actions / .NET CoreInvalid workflow file
|
||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
workflow: refresh readme badges | ||
token: ${{ secrets.RELEASE_PAT }} |