feat(configuration): add user secrets support and required connection… #221
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: CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| env: | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| DOTNET_NOLOGO: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Cache NuGet | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| nuget-${{ runner.os }}- | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Install Playwright | |
| run: npx playwright install --with-deps | |
| working-directory: e2e | |
| if: ${{ hashFiles('e2e/package.json') != '' }} | |
| - name: Test | |
| run: | | |
| dotnet test \ | |
| --configuration Release \ | |
| --no-build \ | |
| --results-directory ./TestResults \ | |
| --logger "trx;LogFileName=testresults.trx" \ | |
| --collect:"XPlat Code Coverage" | |
| - name: Test Report | |
| if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: .NET Tests | |
| path: TestResults/*.trx | |
| reporter: dotnet-trx | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testresults | |
| path: TestResults | |
| # NEW: Coverage report (merge + HTML) | |
| - name: Install ReportGenerator | |
| run: dotnet tool install --global dotnet-reportgenerator-globaltool | |
| - name: Generate Coverage Report | |
| run: | | |
| reportgenerator \ | |
| -reports:"**/TestResults/**/coverage.cobertura.xml" \ | |
| -targetdir:"coverage" \ | |
| -reporttypes:"HtmlInline;TextSummary;Cobertura" | |
| echo "Coverage summary:" | |
| cat coverage/Summary.txt | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## Code Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| cat coverage/Summary.txt >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload Coverage Artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage | |
| # - name: Enforce Minimum Coverage | |
| # run: | | |
| # LINE=$(grep -oP 'Line coverage:\s+\K[0-9]+' coverage/Summary.txt) | |
| # MIN=65 | |
| # echo "Line coverage: ${LINE}% (min ${MIN}%)" | |
| # if [ "$LINE" -lt "$MIN" ]; then | |
| # echo "Coverage below threshold"; exit 1; | |
| # fi | |
| react-build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: src/StockSim.React | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: src/StockSim.React/package-lock.json | |
| - name: Install deps | |
| run: npm ci | |
| - name: Build React app | |
| run: npm run build | |
| docker-build: | |
| needs: [build-test, react-build] | |
| if: | | |
| (github.event_name == 'push' && github.ref == 'refs/heads/master') || | |
| (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build StockSim.Web image (no push) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: stocksim/web:ci | |
| platforms: linux/amd64 | |
| file: src/StockSim.Web/Dockerfile | |
| context: . | |
| - name: Build StockSim.MarketFeed image (no push) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: false | |
| tags: stocksim/marketfeed:ci | |
| platforms: linux/amd64 | |
| file: src/StockSim.MarketFeed/Dockerfile | |
| context: . |