feat: Add option to use other mappers #1572
Workflow file for this run
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: test | |
on: | |
workflow_call: | |
pull_request: | |
branches: | |
- '**' | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
jobs: | |
sample: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
- run: dotnet run --project ./samples/Riok.Mapperly.Sample | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
- run: dotnet build /p:TreatWarningsAsErrors=true | |
- run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover | |
- uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: sudo apt update && sudo apt -y install zipmerge # zipmerge is used to merge the multi target nupkg | |
- uses: actions/[email protected] | |
- run: dotnet tool restore | |
- run: RELEASE_VERSION="0.0.1-dev.$GITHUB_RUN_ID" ./build/package.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mapperly-nupkg | |
path: artifacts/*.nupkg | |
- if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: verify-test-results | |
path: '**/*.received.*' | |
validate-package: | |
needs: package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
- run: dotnet tool restore | |
- uses: actions/download-artifact@v3 | |
with: | |
name: mapperly-nupkg | |
path: artifacts | |
- run: dotnet meziantou.validate-nuget-package ./artifacts/*.nupkg | |
- run: dotnet validate package local ./artifacts/*.nupkg | |
integration-test: | |
needs: package | |
runs-on: ubuntu-latest | |
# use an alpine container to ensure only the dotnet version we want to test is installed, | |
# ubuntu-latest already contains several dotnet versions... | |
container: | |
image: alpine:3.17 | |
strategy: | |
matrix: | |
dotnet: | |
- '8.0' | |
- '7.0' | |
- '6.0' | |
steps: | |
- uses: actions/checkout@v3 | |
# install required dotnet dependencies | |
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-alpine#dependencies | |
- run: apk add --no-cache bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib | |
# delete global.json since we want to use custom versions here | |
- run: rm global.json | |
- uses: actions/[email protected] | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- run: dotnet --list-sdks | |
- uses: actions/download-artifact@v3 | |
with: | |
name: mapperly-nupkg | |
path: artifacts | |
# use nupkg artifact for integration tests instead of project references | |
- run: dotnet nuget add source "$(pwd)/artifacts" | |
- run: >- | |
dotnet build | |
-f net${{ matrix.dotnet }} | |
-p:MapperlyIntegrationTestsTargetFramework=net${{ matrix.dotnet }} | |
-p:MapperlyNugetPackageVersion="0.0.1-dev.$GITHUB_RUN_ID" | |
working-directory: ./test/Riok.Mapperly.IntegrationTests | |
- run: dotnet test --no-build -f net${{ matrix.dotnet }} | |
working-directory: ./test/Riok.Mapperly.IntegrationTests | |
- if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: verify-test-results | |
path: '**/*.received.*' | |
integration-test-net-framework: | |
needs: package | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# delete global.json since we want to use custom versions here | |
- run: rm global.json | |
- uses: actions/download-artifact@v3 | |
with: | |
name: mapperly-nupkg | |
path: artifacts | |
# use nupkg artifact for integration tests instead of project references | |
- run: dotnet nuget add source "$(Get-Location)/artifacts" | |
- run: >- | |
dotnet build | |
-f net48 | |
-p:MapperlyIntegrationTestsTargetFramework=net48 | |
-p:MapperlyNugetPackageVersion=0.0.1-dev.$env:GITHUB_RUN_ID | |
working-directory: ./test/Riok.Mapperly.IntegrationTests | |
- run: dotnet test --no-build -f net48 | |
working-directory: ./test/Riok.Mapperly.IntegrationTests | |
- if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: verify-test-results | |
path: '**/*.received.*' |