feat: .NET 10 + Aspire 13.2 upgrade + Database Plugin Architecture #428
Workflow file for this run
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
| # This workflow will build a .NET project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
| name: .NET Build | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| pull_request: | |
| branches: [ "*" ] | |
| paths: | |
| - 'src/**' | |
| - 'tests/**' | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| global-json-file: global.json | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore | |
| - name: Run Tests | |
| run: dotnet test UnitTests.slnf --no-build --logger trx --results-directory "test-results" | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| id: test-results | |
| if: always() | |
| with: | |
| files: | | |
| test-results/**/*.xml | |
| test-results/**/*.trx | |
| test-results/**/*.json | |
| - name: Set badge color | |
| shell: bash | |
| run: | | |
| case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in | |
| success) | |
| echo "BADGE_COLOR=31c653" >> $GITHUB_ENV | |
| ;; | |
| failure) | |
| echo "BADGE_COLOR=800000" >> $GITHUB_ENV | |
| ;; | |
| neutral) | |
| echo "BADGE_COLOR=696969" >> $GITHUB_ENV | |
| ;; | |
| esac | |
| - name: Create badge | |
| uses: emibcn/badge-action@808173dd03e2f30c980d03ee49e181626088eee8 | |
| with: | |
| label: Unit Tests | |
| status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}' | |
| color: ${{ env.BADGE_COLOR }} | |
| path: badge.svg | |
| - name: Upload badge to Azure Blob Storage | |
| if: always() && (github.ref == 'refs/heads/main' || github.base_ref == 'refs/heads/main') | |
| shell: pwsh | |
| env: | |
| AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }} | |
| AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }} | |
| AZURE_STORAGE_CONTAINER: ${{ secrets.AZURE_STORAGE_CONTAINER }} | |
| run: | | |
| echo "Uploading badge to Azure Blob Storage in storage account $env:AZURE_STORAGE_ACCOUNT" | |
| az storage blob upload --account-name $env:AZURE_STORAGE_ACCOUNT --account-key $env:AZURE_STORAGE_KEY --container-name $env:AZURE_STORAGE_CONTAINER --file badge.svg --name unittest-badge.svg --overwrite true | |
| publish-container: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Get most recent tag | |
| id: get-tag | |
| run: | | |
| TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| echo "::set-output name=tag::$TAG" | |
| - name: Build Docker image | |
| run: | | |
| docker build -t ghcr.io/fritzandfriends/sharpsite:${{ github.sha }} . | |
| if [ "${{ steps.get-tag.outputs.tag }}" ]; then | |
| docker tag ghcr.io/fritzandfriends/sharpsite:${{ github.sha }} ghcr.io/fritzandfriends/sharpsite:${{ steps.get-tag.outputs.tag }} | |
| fi | |
| docker tag ghcr.io/fritzandfriends/sharpsite:${{ github.sha }} ghcr.io/fritzandfriends/sharpsite:latest | |
| - name: Push Docker image | |
| run: | | |
| docker push ghcr.io/fritzandfriends/sharpsite:${{ github.sha }} | |
| if [ "${{ steps.get-tag.outputs.tag }}" ]; then | |
| docker push ghcr.io/fritzandfriends/sharpsite:${{ steps.get-tag.outputs.tag }} | |
| fi | |
| docker push ghcr.io/fritzandfriends/sharpsite:latest |