Merge with latest main #545
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
# | |
# This workflow will build and run all unit tests using dotnet docker containers, | |
# each targeting a single version of the dotnet SDK. | |
# | |
name: dotnet-ci-docker | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main", "feature*" ] | |
paths: | |
- 'dotnet/**' | |
- 'samples/dotnet/**' | |
permissions: | |
contents: read | |
jobs: | |
build-and-test-docker: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-latest, dotnet: '6.0', configuration: Debug } | |
- { os: ubuntu-latest, dotnet: '6.0', configuration: Release } | |
- { os: ubuntu-latest, dotnet: '7.0', configuration: Release } | |
- { os: ubuntu-latest, dotnet: '8.0-preview', configuration: Release } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
clean: true | |
- name: Find solutions | |
shell: bash | |
run: echo "solutions=$(find ./ -type f -name "*.sln" | tr '\n' ' ')" >> $GITHUB_ENV | |
- name: Pull container dotnet/sdk:${{ matrix.dotnet }} | |
run: | | |
docker pull mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} | |
- name: Build dotnet solution | |
run: | | |
for solution in ${{ env.solutions }}; do | |
docker run --rm -v $(pwd):/app -w /app -e GITHUB_ACTIONS='true' mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "dotnet build -c ${{ matrix.configuration }} /app/$solution" | |
done | |
- name: Find unit test projects | |
shell: bash | |
run: echo "testprojects=$(find ./dotnet -type f -name "*.UnitTests.csproj" | tr '\n' ' ')" >> $GITHUB_ENV | |
- name: Run Unit Tests | |
run: | | |
for project in ${{ env.testprojects }}; do | |
docker run --rm -v $(pwd):/app -w /app mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "dotnet test -c ${{ matrix.configuration }} /app/$project --no-build -v Normal --logger trx" | |
done | |
- name: Stage artifacts | |
shell: bash | |
run: mkdir ./out; find . | grep "/bin/" | xargs cp -r --parents -t ./out | |
- name: Archive artifacts ${{ matrix.os }}-${{ matrix.configuration }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: drop-${{ matrix.os }}-dotnet${{matrix.dotnet}}-${{ matrix.configuration }} | |
path: ./out |