Skip to content

Add cascading metadata (#36) #46

Add cascading metadata (#36)

Add cascading metadata (#36) #46

Workflow file for this run

name: build
on:
push:
branches:
- main
- release-*
tags:
- v*
pull_request:
branches:
- main
- release-*
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Lint
run: dotnet format --verify-no-changes
build:
name: Build
runs-on: ubuntu-latest
env:
NUPKG_OUTDIR: bin/Release/nugets
steps:
- uses: actions/checkout@v1
- name: Parse release version
run: python ./.github/scripts/get_release_version.py
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Build
run: dotnet build --configuration release
- name: Generate Packages
run: dotnet pack --configuration release
- name: Upload packages
uses: actions/upload-artifact@master
with:
name: packages
path: ${{ env.NUPKG_OUTDIR }}
test:
name: Test .NET ${{ matrix.dotnet-version }}
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['6.0','7.0']
include:
- dotnet-version: '6.0'
install-3: false
display-name: '.NET 6.0'
framework: 'net6.0'
prefix: 'net6'
install-version: '6.0.x'
- dotnet-version: '7.0'
install-3: false
display-name: '.NET 7.0'
framework: 'net7.0'
prefix: 'net7'
install-version: '7.0.x'
steps:
- uses: actions/checkout@v1
- name: Parse release version
run: python ./.github/scripts/get_release_version.py
- name: Setup ${{ matrix.display-name }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.install-version }}
- name: Setup .NET 7.0 # net7 is always required.
uses: actions/setup-dotnet@v1
if: ${{ matrix.install-version != '7.0.x' }}
with:
dotnet-version: 7.0.x
- name: Build
# disable deterministic builds, just for test run. Deterministic builds break coverage for some reason
run: dotnet build --configuration release /p:GITHUB_ACTIONS=false
- name: Test
id: tests
continue-on-error: true # proceed if tests fail to allow for the report generation in master or next step failure in PR
run: |
dotnet test \
--configuration release \
--framework ${{ matrix.framework }} \
--no-build \
--no-restore \
--logger "trx;LogFilePrefix=${{ matrix.prefix }}" \
--logger "GitHubActions;report-warnings=false" \
--results-directory "${{ github.workspace }}/TestResults" \
/p:CollectCoverage=true \
/p:CoverletOutputFormat=opencover \
/p:GITHUB_ACTIONS=false
- name: Check test failure in PR
if: github.event_name == 'pull_request' && steps.tests.outcome != 'success'
run: exit 1
- name: Parse Trx files
uses: NasAmin/trx-parser@v0.2.0
id: trx-parser
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository # does not work on PRs from forks
with:
TRX_PATH: ${{ github.workspace }}/TestResults
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish Packages
needs: ['build']
runs-on: ubuntu-latest
if: startswith(github.ref, 'refs/tags/v') && !(endsWith(github.ref, '-rc') || endsWith(github.ref, '-dev') || endsWith(github.ref, '-prerelease'))
steps:
- name: Download release artifacts
uses: actions/download-artifact@v2
with:
name: packages
path: packages
- name: List packages (for sanity check)
run: ls -R
working-directory: packages
- name: Publish binaries to github for tags
if: startswith(github.ref, 'refs/tags/v')
run: |
sudo npm install --silent --no-progress -g github-release-cli@1.3.1
# Parse repository to get owner and repo names
OWNER_NAME="${GITHUB_REPOSITORY%%/*}"
REPO_NAME="${GITHUB_REPOSITORY#*/}"
# Get the list of files
RELEASE_ARTIFACT=(./packages/*)
export GITHUB_TOKEN=${{ secrets.DAPR_BOT_TOKEN }}
echo "Uploading Nuget packages to GitHub Release"
github-release upload \
--owner $OWNER_NAME \
--repo $REPO_NAME \
--body "Release Dapr Pluggable Components SDK v${REL_VERSION}" \
--tag "v${REL_VERSION}" \
--name "Dapr .NET Pluggable Components SDK v${REL_VERSION}" \
--prerelease true \
${RELEASE_ARTIFACT[*]}
- name: Publish nuget packages to nuget.org
if: startswith(github.ref, 'refs/tags/v') && !(endsWith(github.ref, '-rc') || endsWith(github.ref, '-dev') || endsWith(github.ref, '-prerelease'))
run: |
dotnet nuget push "./packages/Dapr*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGETORG_DAPR_API_KEY }} --source https://api.nuget.org/v3/index.json