Added workflow sample: Sub-workflows (#1395) #1964
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: integration-test | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
- release-* | |
jobs: | |
build: | |
name: run integration tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
dotnet-version: ['6.0', '7.0', '8.0'] | |
include: | |
- dotnet-version: '6.0' | |
display-name: '.NET 6.0' | |
framework: 'net6' | |
prefix: 'net6' | |
install-version: '6.0.x' | |
- dotnet-version: '7.0' | |
display-name: '.NET 7.0' | |
framework: 'net7' | |
prefix: 'net7' | |
install-version: '7.0.x' | |
- dotnet-version: '8.0' | |
display-name: '.NET 8.0' | |
framework: 'net8' | |
prefix: 'net8' | |
install-version: '8.0.x' | |
env: | |
NUPKG_OUTDIR: bin/Release/nugets | |
GOVER: 1.20.3 | |
GOOS: linux | |
GOARCH: amd64 | |
GOPROXY: https://proxy.golang.org | |
DAPR_CLI_VER: 1.14.0 | |
DAPR_RUNTIME_VER: 1.14.0 | |
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/release-1.14/install/install.sh | |
DAPR_CLI_REF: '' | |
steps: | |
- name: Set up Dapr CLI | |
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }} | |
- name: Checkout Dapr CLI repo to override dapr command. | |
uses: actions/checkout@v2 | |
if: env.DAPR_CLI_REF != '' | |
with: | |
repository: dapr/cli | |
ref: ${{ env.DAPR_CLI_REF }} | |
path: cli | |
- name: Checkout Dapr repo to override daprd. | |
uses: actions/checkout@v2 | |
if: env.DAPR_REF != '' | |
with: | |
repository: dapr/dapr | |
ref: ${{ env.DAPR_REF }} | |
path: dapr | |
- name: Set up Go from dapr/go.mod | |
if: env.DAPR_REF != '' | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "dapr/go.mod" | |
- name: Set up Go from cli/go.mod | |
if: env.DAPR_REF == '' && env.DAPR_CLI_REF != '' | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "cli/go.mod" | |
- name: Build and override dapr cli with referenced commit. | |
if: env.DAPR_CLI_REF != '' | |
run: | | |
cd cli | |
make | |
sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr | |
cd .. | |
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }} | |
run: | | |
dapr uninstall --all | |
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }} | |
- name: Build and override daprd with referenced commit. | |
if: env.DAPR_REF != '' | |
run: | | |
cd dapr | |
make | |
mkdir -p $HOME/.dapr/bin/ | |
cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd | |
cd .. | |
- name: Override placement service. | |
if: env.DAPR_REF != '' | |
run: | | |
docker stop dapr_placement | |
cd dapr | |
./dist/linux_amd64/release/placement & | |
- 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 8.0 # net8 is always required. | |
uses: actions/setup-dotnet@v1 | |
if: ${{ matrix.install-version != '8.0.x' }} | |
with: | |
dotnet-version: 8.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: Run General Tests | |
id: tests | |
continue-on-error: true # proceed if tests fail, the report step will report the failure with more details. | |
run: | | |
dotnet test ${{ github.workspace }}/test/Dapr.E2E.Test/Dapr.E2E.Test.csproj \ | |
--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: Run Generators Tests | |
id: generator-tests | |
continue-on-error: true # proceed if tests fail, the report step will report the failure with more details. | |
run: | | |
dotnet test ${{ github.workspace }}/test/Dapr.E2E.Test.Actors.Generators/Dapr.E2E.Test.Actors.Generators.csproj \ | |
--configuration Release \ | |
--framework ${{ matrix.framework }} \ | |
--no-build \ | |
--no-restore \ | |
--logger "trx;LogFilePrefix=${{ matrix.prefix }}" \ | |
--logger "GitHubActions;report-warnings=false" \ | |
--logger "console;verbosity=detailed" \ | |
--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' || steps.generator-tests.outcome != 'success') | |
run: exit 1 | |
- name: Upload test coverage | |
uses: codecov/codecov-action@v1 | |
with: | |
flags: ${{ matrix.framework }} | |
- name: Parse Trx files | |
uses: NasAmin/[email protected] | |
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 }} |