Updated CI pipeline #332
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: CI | |
on: | |
push: | |
branches-ignore: | |
- 'wip/**' | |
pull_request: | |
branches-ignore: | |
- 'wip/**' | |
release: | |
types: [published] | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
dotnet: ['6.0.x', '8.0.x'] | |
runs-on: ${{ matrix.os }} | |
name: Test on ${{ matrix.os }} using dotnet ${{ matrix.dotnet }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
${{ matrix.dotnet }} | |
- name: Init workflow variables | |
run: pwsh .github/workflows/Init-WorkflowVariables.ps1 | |
- name: Compile | |
run: pwsh build.ps1 --target compile --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }} | |
- name: Tests | |
run: pwsh build.ps1 --target tests --skip --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }} | |
- name: Upload artifact; details of failed tests | |
uses: actions/upload-artifact@v1 | |
if: failure() | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.${{ matrix.dotnet }}.${{ matrix.os }}.testresults | |
path: artifacts/tests/Validot.${{ env.VALIDOT_VERSION }}.testresults | |
tests_netframework: | |
strategy: | |
matrix: | |
os: [ windows-latest ] | |
dotnet: [ net48 ] | |
runs-on: ${{ matrix.os }} | |
name: Test on ${{ matrix.os }} using dotnet ${{ matrix.dotnet }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Setup base dotnet sdk | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Init workflow variables | |
run: pwsh .github/workflows/Init-WorkflowVariables.ps1 | |
- name: Compile | |
run: pwsh build.ps1 --target compile --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }} | |
- name: Tests | |
run: pwsh build.ps1 --target tests --skip --dotnet ${{ matrix.dotnet }} --configuration release --version ${{ env.VALIDOT_VERSION }} | |
- name: Upload artifact; details of failed tests | |
uses: actions/upload-artifact@v1 | |
if: failure() | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.${{ matrix.dotnet }}.${{ matrix.os }}.testresults | |
path: artifacts/tests/Validot.${{ env.VALIDOT_VERSION }}.testresults | |
code_coverage: | |
needs: [ tests, tests_netframework ] | |
if: github.event_name == 'release' || github.event_name == 'pull_request' || github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
name: Code coverage | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Setup base dotnet sdk | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Init workflow variables | |
run: pwsh .github/workflows/Init-WorkflowVariables.ps1 | |
- name: Analyze code coverage | |
run: pwsh build.ps1 --target codecoveragereport --dotnet 6.0.x --configuration debug --version ${{ env.VALIDOT_VERSION }} | |
- name: Upload artifact; code coverage data | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.opencover.xml | |
path: artifacts/coverage/Validot.${{ env.VALIDOT_VERSION }}.opencover.xml | |
- name: Upload artifact; code coverage summary | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json | |
path: artifacts/coverage_reports/Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json | |
- name: Upload artifact; code coverage report | |
if: github.event_name == 'release' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_report | |
path: artifacts/coverage_reports/Validot.${{ env.VALIDOT_VERSION }}.coverage_report | |
- name: Publish code coverage | |
if: github.event_name != 'pull_request' | |
run: pwsh build.ps1 --target publishcodecoverage --skip --dotnet 6.0.x --configuration debug --version ${{ env.VALIDOT_VERSION }} --commitsha ${{ github.sha }} --codecovapikey ${{ secrets.CODECOV_API_KEY }} --required | |
nuget_package: | |
needs: [ tests, tests_netframework ] | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
name: NuGet package | |
steps: | |
- name: Checking out code | |
uses: actions/checkout@v2 | |
- name: Setup base dotnet sdk | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Init workflow variables | |
run: pwsh .github/workflows/Init-WorkflowVariables.ps1 | |
- name: Create package | |
run: pwsh build.ps1 --target nugetpackage --dotnet 6.0.x --configuration release --commitsha ${{ github.sha }} --version ${{ env.VALIDOT_VERSION }} | |
- name: Upload artifact; nuget package | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.nupkg | |
path: artifacts/nuget/${{ env.VALIDOT_VERSION }}/Validot.${{ env.VALIDOT_VERSION }}.nupkg | |
- name: Upload artifact; nuget package symbols | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.snupkg | |
path: artifacts/nuget/${{ env.VALIDOT_VERSION }}/Validot.${{ env.VALIDOT_VERSION }}.snupkg | |
- name: Publish nuget package | |
run: pwsh build.ps1 --target publishnugetpackage --skip --dotnet 6.0.x --configuration release --version ${{ env.VALIDOT_VERSION }} --commitsha ${{ github.sha }} --nugetapikey ${{ secrets.NUGET_API_KEY }} | |
release_assets: | |
needs: [ code_coverage, nuget_package ] | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
name: Upload release assets | |
steps: | |
- name: Checking out code | |
uses: actions/checkout@v2 | |
- name: Init workflow variables | |
run: pwsh .github/workflows/Init-WorkflowVariables.ps1 | |
- name: Download artifact; nuget package | |
uses: actions/download-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.nupkg | |
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget | |
- name: Download artifact; nuget package symbols | |
uses: actions/download-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.snupkg | |
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget | |
- name: Download artifact; code coverage data | |
uses: actions/download-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.opencover.xml | |
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage/data | |
- name: Download artifact; code coverage summary | |
uses: actions/download-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_summary.json | |
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage | |
- name: Download artifact; code coverage report | |
uses: actions/download-artifact@v1 | |
with: | |
name: Validot.${{ env.VALIDOT_VERSION }}.coverage_report | |
path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage/report | |
- name: Zip artifacts | |
run: | | |
cd artifacts | |
zip -rX Validot.${{ env.VALIDOT_VERSION }}.nuget.zip Validot.${{ env.VALIDOT_VERSION }}.nuget | |
zip -rX Validot.${{ env.VALIDOT_VERSION }}.coverage.zip Validot.${{ env.VALIDOT_VERSION }}.coverage | |
- name: Upload release asset; nuget package with symbols | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.nuget.zip | |
asset_name: Validot.${{ env.VALIDOT_VERSION }}.nuget.zip | |
asset_content_type: application/zip | |
- name: Upload release asset; code coverage data and reports | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: artifacts/Validot.${{ env.VALIDOT_VERSION }}.coverage.zip | |
asset_name: Validot.${{ env.VALIDOT_VERSION }}.coverage.zip | |
asset_content_type: application/zip |