docs: add contribution requirements evidence (#136) #330
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, and Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Cache NuGet Packages | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }} | |
| restore-keys: | | |
| nuget-${{ runner.os }} | |
| - name: Restore dependencies | |
| run: dotnet restore --locked-mode | |
| working-directory: ./src | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release -p:Version=0.0.0 | |
| working-directory: ./src | |
| - name: Test with coverage | |
| run: dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults | |
| working-directory: ./src | |
| - name: Upload coverage reports | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: coverage-${{ github.run_id }} | |
| path: src/TestResults/**/coverage.cobertura.xml | |
| if-no-files-found: warn | |
| - name: Pack NuGet Package | |
| run: dotnet pack --no-build --configuration Release --output ./nupkg -p:Version=0.0.0 | |
| working-directory: ./src | |
| publish: | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.actor != 'github-actions[bot]' | |
| environment: nuget-publish | |
| env: | |
| BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | |
| permissions: | |
| contents: write | |
| id-token: write | |
| packages: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@7417b1089e2c7de93510f1901d656ddf60bb024f # v4.7.0 | |
| with: | |
| versionSpec: '6.7.x' | |
| - name: Determine Version | |
| id: version_step # step id used as reference for output values | |
| shell: pwsh | |
| run: | | |
| $gitVersionJson = dotnet-gitversion "$env:GITHUB_WORKSPACE" /config VersionConfig.yml /output json | Out-String | |
| $gitVersion = ($gitVersionJson.TrimStart([char]0xFEFF) | ConvertFrom-Json) | |
| "FullSemVer=$($gitVersion.FullSemVer)" >> $env:GITHUB_OUTPUT | |
| "AssemblySemVer=$($gitVersion.AssemblySemVer)" >> $env:GITHUB_OUTPUT | |
| "AssemblySemFileVer=$($gitVersion.AssemblySemFileVer)" >> $env:GITHUB_OUTPUT | |
| - name: Restore dependencies | |
| run: dotnet restore --locked-mode | |
| working-directory: ./src | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release -p:Version=${{ steps.version_step.outputs.FullSemVer }} -p:AssemblyVersion=${{ steps.version_step.outputs.AssemblySemVer }} -p:FileVersion=${{ steps.version_step.outputs.AssemblySemFileVer }} | |
| working-directory: ./src | |
| - name: Test with coverage | |
| run: dotnet test --no-build --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults | |
| working-directory: ./src | |
| - name: Upload coverage reports | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: coverage-${{ github.run_id }} | |
| path: src/TestResults/**/coverage.cobertura.xml | |
| if-no-files-found: warn | |
| - name: Pack NuGet Package | |
| run: dotnet pack --no-build --configuration Release --output ./nupkg -p:Version=${{ steps.version_step.outputs.FullSemVer }} -p:AssemblyVersion=${{ steps.version_step.outputs.AssemblySemVer }} -p:FileVersion=${{ steps.version_step.outputs.AssemblySemFileVer }} | |
| working-directory: ./src | |
| - name: Publish Commandline (linux-x64) | |
| run: dotnet publish -c Release -r linux-x64 --self-contained | |
| working-directory: ./src/FrontierSharp.CommandLine | |
| - name: Publish Commandline (linux-arm64) | |
| run: dotnet publish -c Release -r linux-arm64 --self-contained | |
| working-directory: ./src/FrontierSharp.CommandLine | |
| - name: Publish Commandline (osx-x64) | |
| run: dotnet publish -c Release -r osx-x64 --self-contained | |
| working-directory: ./src/FrontierSharp.CommandLine | |
| - name: Publish Commandline (osx-arm64) | |
| run: dotnet publish -c Release -r osx-arm64 --self-contained | |
| working-directory: ./src/FrontierSharp.CommandLine | |
| - name: Publish Commandline (win-x64) | |
| run: dotnet publish -c Release -r win-x64 --self-contained | |
| working-directory: ./src/FrontierSharp.CommandLine | |
| - name: Publish Commandline (win-arm64) | |
| run: dotnet publish -c Release -r win-arm64 --self-contained | |
| working-directory: ./src/FrontierSharp.CommandLine | |
| - name: Get short-lived NuGet API key | |
| id: nuget-login | |
| uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1 | |
| with: | |
| user: Scetrov | |
| - name: Publish NuGet Package to NuGet.org | |
| run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| working-directory: ./src | |
| - name: Publish NuGet Symbol Package to NuGet.org | |
| run: dotnet nuget push ./nupkg/*.snupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| working-directory: ./src | |
| - name: Publish NuGet Package to GitHub Packages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: dotnet nuget push ./nupkg/*.nupkg --api-key $GITHUB_TOKEN --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json | |
| working-directory: ./src | |
| - name: Create Linux-x64 Archive | |
| run: tar -czf "$GITHUB_WORKSPACE/src/frontierctl-linux-x64.tar.gz" . | |
| working-directory: ./src/FrontierSharp.CommandLine/bin/Release/net10.0/linux-x64/publish | |
| - name: Create Linux-arm64 Archive | |
| run: tar -czf "$GITHUB_WORKSPACE/src/frontierctl-linux-arm64.tar.gz" . | |
| working-directory: ./src/FrontierSharp.CommandLine/bin/Release/net10.0/linux-arm64/publish | |
| - name: Create OSX-x64 Archive | |
| run: tar -czf "$GITHUB_WORKSPACE/src/frontierctl-osx-x64.tar.gz" . | |
| working-directory: ./src/FrontierSharp.CommandLine/bin/Release/net10.0/osx-x64/publish | |
| - name: Create OSX-arm64 Archive | |
| run: tar -czf "$GITHUB_WORKSPACE/src/frontierctl-osx-arm64.tar.gz" . | |
| working-directory: ./src/FrontierSharp.CommandLine/bin/Release/net10.0/osx-arm64/publish | |
| - name: Create Windows-x64 Archive | |
| run: zip -qr "$GITHUB_WORKSPACE/src/frontierctl-win-x64.zip" . | |
| working-directory: ./src/FrontierSharp.CommandLine/bin/Release/net10.0/win-x64/publish | |
| - name: Create Windows-arm64 Archive | |
| run: zip -qr "$GITHUB_WORKSPACE/src/frontierctl-win-arm64.zip" . | |
| working-directory: ./src/FrontierSharp.CommandLine/bin/Release/net10.0/win-arm64/publish | |
| - name: Create Release | |
| uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 | |
| with: | |
| tag: ${{ steps.version_step.outputs.FullSemVer }} | |
| commit: ${{ github.sha }} | |
| artifacts: "./src/nupkg/*.nupkg,./src/nupkg/*.snupkg,./src/*.tar.gz,./src/*.zip" | |
| generateReleaseNotes: true | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.6.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Set lowercase repository name | |
| id: repo_name | |
| shell: bash | |
| run: | | |
| echo "repo_lc=${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" | |
| - name: Extract release version | |
| id: meta | |
| uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 | |
| with: | |
| images: ghcr.io/${{ steps.repo_name.outputs.repo_lc }} | |
| tags: | | |
| type=semver,pattern=v{{major}},value=${{ steps.version_step.outputs.FullSemVer }} | |
| type=semver,pattern=v{{major}}.{{minor}},value=${{ steps.version_step.outputs.FullSemVer }} | |
| type=semver,pattern=v{{version}},value=${{ steps.version_step.outputs.FullSemVer }} | |
| - name: Build and push Docker image | |
| id: push | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: ./src/FrontierSharp.CommandLine | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| provenance: true | |
| sbom: true |