Remove appveyor pipeline files as we are using github actions now #135
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 and Test | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| runPublish: | |
| description: 'Publish Nuget ?' | |
| required: true | |
| default: false | |
| type: boolean | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| semver: ${{ steps.gitversion.outputs.semVer }} | |
| fullsemver: ${{ steps.gitversion.outputs.fullSemVer }} | |
| nugetversion: ${{ steps.gitversion.outputs.fullSemVer }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # Required for GitVersion | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v4.1.0 | |
| with: | |
| versionSpec: '6.x' | |
| - name: Determine Version | |
| uses: gittools/actions/gitversion/execute@v4.1.0 | |
| id: gitversion | |
| - name: Format NuGet version | |
| run: | | |
| buildNumber="${{steps.gitversion.outputs.preReleaseNumber}}${{ steps.gitversion.outputs.buildMetaData }}" | |
| if [[ "${GITHUB_REF}" != "refs/heads/${{ github.event.repository.default_branch }}" ]]; then | |
| buildNumber="${buildNumber}-beta" | |
| fi | |
| packageVersion="${{ steps.gitversion.outputs.majorMinorPatch }}.${buildNumber}" | |
| echo "packageVersion=$packageVersion" >> $GITHUB_OUTPUT | |
| id: formatversion | |
| - name: Display GitVersion outputs | |
| run: | | |
| echo "Version: ${{ steps.gitversion.outputs.semVer }}" | |
| echo "AssemblyVersion: ${{ steps.gitversion.outputs.assemblySemVer }}" | |
| echo "FileVersion: ${{ steps.gitversion.outputs.assemblySemFileVer }}" | |
| echo "NuGet Version: ${{ steps.gitversion.outputs.fullSemVer }}" | |
| echo "Package Version: ${{ steps.formatversion.outputs.packageVersion }}" | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Build project | |
| working-directory: src | |
| run: >- | |
| dotnet build --configuration Release | |
| /p:Version=${{ steps.gitversion.outputs.assemblySemVer }} | |
| /p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }} | |
| /p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }} | |
| /p:PackageVersion=${{ steps.formatversion.outputs.packageVersion }} | |
| - name: Run tests with coverage | |
| working-directory: src | |
| env: | |
| DiffEngine_Disabled: 'true' | |
| run: >- | |
| dotnet test | |
| --configuration Release | |
| --collect:"XPlat Code Coverage" | |
| --results-directory ../coverage | |
| - name: Generate coverage report | |
| uses: danielpalme/ReportGenerator-GitHub-Action@5.4.16 | |
| with: | |
| reports: 'coverage/**/coverage.cobertura.xml' | |
| targetdir: 'coverage-report' | |
| reporttypes: 'Html;Cobertura;TextSummary' | |
| - name: Display Code Coverage Summary | |
| run: | | |
| echo "## π Code Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| if [ -f "coverage-report/Summary.txt" ]; then | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat coverage-report/Summary.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "### Build Log Coverage Summary:" | |
| cat coverage-report/Summary.txt | |
| else | |
| echo "β οΈ Coverage summary file not found" | |
| echo "β οΈ Coverage summary file not found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Generate Rich Release Notes | |
| id: release_notes | |
| uses: mikepenz/release-changelog-builder-action@v5.4.1 | |
| with: | |
| configuration: | | |
| { | |
| "template": "## π Release ${{ steps.gitversion.outputs.semVer }}\n\n### π Release Information\n- **Version**: ${{ steps.gitversion.outputs.semVer }}\n- **NuGet Version**: ${{ steps.gitversion.outputs.fullSemVer }}\n- **Build Date**: $(date -u +'%Y-%m-%d %H:%M:%S UTC')\n- **Commit**: ${{ github.sha }}\n\n#{{CHANGELOG}}\n\n### π Statistics\n- **Total Changes**: #{{UNCATEGORIZED_COUNT}} commits\n- **Contributors**: #{{CONTRIBUTORS}}\n\n---\n*Generated automatically by GitHub Actions*", | |
| "categories": [ | |
| { | |
| "title": "## π Features", | |
| "labels": ["feature", "enhancement", "feat"] | |
| }, | |
| { | |
| "title": "## π Bug Fixes", | |
| "labels": ["bug", "fix", "bugfix"] | |
| }, | |
| { | |
| "title": "## π Documentation", | |
| "labels": ["documentation", "docs"] | |
| }, | |
| { | |
| "title": "## π§ Maintenance", | |
| "labels": ["maintenance", "chore", "refactor"] | |
| }, | |
| { | |
| "title": "## β οΈ Breaking Changes", | |
| "labels": ["breaking", "breaking-change"] | |
| } | |
| ], | |
| "pr_template": "- #{{TITLE}} (#{{NUMBER}}) by @#{{AUTHOR}}", | |
| "empty_template": "- #{{TITLE}} (#{{HASH}}) by @#{{AUTHOR}}", | |
| "max_pull_requests": 200, | |
| "max_back_track_time_days": 365 | |
| } | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Save Release Notes to File | |
| run: echo "${{ steps.release_notes.outputs.changelog }}" > release-notes.md | |
| - name: Upload Release Notes as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-notes | |
| path: release-notes.md | |
| - name: Check for changes in Samples | |
| id: changes | |
| run: | | |
| if git diff --quiet origin/main HEAD -- src/Samples/; then | |
| echo "SamplesUpdated=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "SamplesUpdated=true" >> $GITHUB_OUTPUT | |
| fi | |
| if git diff --quiet origin/main HEAD -- src/TestStack.BDDfy/; then | |
| echo "BddfyUpdated=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "BddfyUpdated=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create NuGet package | |
| working-directory: src | |
| run: >- | |
| dotnet pack | |
| --configuration Release | |
| --no-build | |
| /p:PackageVersion=${{ steps.formatversion.outputs.packageVersion }} | |
| --output ../packages | |
| - name: Upload NuGet package as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: packages/*.nupkg | |
| - name: Publish coverage report as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage-report/ | |
| publish-nuget: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event.inputs.runPublish == 'true' || github.ref_name == github.event.repository.default_branch | |
| environment: | |
| name: Publish | |
| url: https://www.nuget.org/packages/TestStack.BDDfy/ | |
| steps: | |
| - name: Download NuGet package | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: nuget-package | |
| path: packages | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Publish to NuGet | |
| run: dotnet nuget push packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| create-release-tag: | |
| runs-on: ubuntu-latest | |
| needs: [build, publish-nuget] | |
| if: github.event.inputs.runPublish == 'true' && github.ref_name == github.event.repository.default_branch | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if tag already exists | |
| id: check_tag | |
| run: | | |
| TAG="v${{ needs.build.outputs.semver }}" | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "Tag $TAG already exists" | |
| echo "tag_exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Creating new tag: $TAG" | |
| echo "tag_exists=false" >> $GITHUB_OUTPUT | |
| echo "new_tag=$TAG" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download Release Notes | |
| if: steps.check_tag.outputs.tag_exists == 'false' | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: release-notes | |
| path: . | |
| - name: Create Git Tag and GitHub Release | |
| if: steps.check_tag.outputs.tag_exists == 'false' | |
| run: | | |
| TAG="${{ steps.check_tag.outputs.new_tag }}" | |
| # Configure git | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Create and push tag | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push origin "$TAG" | |
| # Create GitHub release | |
| gh release create "$TAG" \ | |
| --title "Release $TAG" \ | |
| --notes-file release-notes.md \ | |
| --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |