diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..7d378a9f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + ContinuousIntegrationBuild: true + CiRunNumber: ${{ github.run_number }} + CiRunPushSuffix: ${{ github.ref_name }}-ci${{ github.run_number }} + CiRunPullSuffix: pull-${{ github.event.number }}-ci${{ github.run_number }} +jobs: + build: + strategy: + fail-fast: false + matrix: + configuration: [debug, release] + os: [ubuntu-latest, windows-latest] + include: + - os: windows-latest + configuration: release + collect-packages: true + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration ${{ matrix.configuration }} + + - name: Pack + id: pack + if: matrix.collect-packages + env: + CiBuildVersionSuffix: ${{ github.event_name == 'push' && env.CiRunPushSuffix || env.CiRunPullSuffix }} + run: dotnet pack --no-build --configuration ${{ matrix.configuration }} + + - name: Collect packages + uses: actions/upload-artifact@v4 + if: matrix.collect-packages && steps.pack.outcome == 'success' && always() + with: + name: Packages + if-no-files-found: error + path: artifacts/package/${{matrix.configuration}}/** \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 65e9f944..ab09a897 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,6 +19,8 @@ strict + + diff --git a/build/Version.props b/build/Version.props new file mode 100644 index 00000000..d7d1fa24 --- /dev/null +++ b/build/Version.props @@ -0,0 +1,20 @@ + + + + 0 + + dev$(DevVersion) + <_FileVersionRevision>$([MSBuild]::Add(60000, $(DevVersion))) + + + + $(CiBuildVersionSuffix) + <_FileVersionRevision>0 + <_FileVersionRevision Condition="'$(CiBuildVersionSuffix)' != '' and '$(CiRunNumber)' != ''">$(CiRunNumber) + + + + + $(WarningsAsErrors);CS7035 + + \ No newline at end of file