Hide approval files in Solution Explorer (#627) #132
This file contains hidden or 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: Build, test, pack, push (CI) | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: windows-latest | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Install additional .NET SDKs | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
2.1.x | |
3.1.x | |
5.0.x | |
6.0.x | |
8.0.x | |
- name: Run tests | |
working-directory: QRCoderTests | |
run: dotnet test -c Debug --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover | |
- name: Upload coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-files | |
path: QRCoderTests/coverage.*.xml | |
retention-days: 1 | |
upload-coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-files | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
additional-tests: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Run trim analysis | |
working-directory: QRCoderTrimAnalysis | |
run: dotnet publish -c Release -o bin/publish | |
- name: Run API approval tests | |
working-directory: QRCoderApiTests | |
run: dotnet test -c Release --nologo | |
pack-push-ci: | |
needs: [test, additional-tests, upload-coverage] | |
runs-on: windows-latest | |
env: | |
GH_PKG_SEC: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build library | |
run: dotnet build -c Release --no-restore | |
- name: Get assembly version QRCoder | |
run: echo "ASSEM_VER=$([Reflection.Assembly]::Loadfile( $(-join($pwd,"\QRCoder\bin\Release\net40\QRCoder.dll"))).GetName().version.ToString())" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Clean assembly version QRCoder | |
run: echo "ASSEM_VER_SHT=$($env:ASSEM_VER.substring(0, $env:ASSEM_VER.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Calculate ci suffix QRCoder | |
run: echo "CI_TAG=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Get assembly version QRCoder.Xaml | |
run: echo "ASSEM_VER_XAML=$([Reflection.Assembly]::Loadfile( $(-join($pwd,"\QRCoder.Xaml\bin\Release\net40\QRCoder.Xaml.dll"))).GetName().version.ToString())" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Clean assembly version QRCoder.Xaml | |
run: echo "ASSEM_VER_SHT_XAML=$($env:ASSEM_VER_XAML.substring(0, $env:ASSEM_VER_XAML.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Calculate ci suffix QRCoder.Xaml | |
run: echo "CI_TAG_XAML=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Build QRCoder NuGet package | |
run: dotnet pack QRCoder\QRCoder.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT$env:CI_TAG" /p:PackageReleaseNotes="- This is an automatic CI build ($env:CI_TAG)`n- Please don't use it in productive environments!" | |
- name: Build QRCoder.Xaml NuGet package | |
run: dotnet pack QRCoder.Xaml\QRCoder.Xaml.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT_XAML$env:CI_TAG_XAML" /p:PackageReleaseNotes="- This is an automatic CI build ($env:CI_TAG_XAML)`n- Please don't use it in productive environments!" | |
- name: Publish QRCoder and QRCoder.Xaml to Github packages | |
run: dotnet nuget push "**/*.nupkg" --no-symbols --skip-duplicate --api-key $env:GH_PKG_SEC --source https://nuget.pkg.github.com/Shane32/index.json |