From 82f946003e523ec9888bc6e369b1dc71173da720 Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Thu, 11 Jan 2024 16:34:05 -0500 Subject: [PATCH] chore: Add support for GitHub Packages | GITHUB_REF | version format | |---------------|--------------------------------------------------| | refs/heads/* | #.#.#-ci.{%Y%m%d}T{%H%M%S}+sha.${GITHUB_SHA:0:9} | | refs/pull/* | #.#.#-pr.{%Y%m%d}T{%H%M%S}+sha.${GITHUB_SHA:0:9} | | refs/tags/v* | #.#.# | See: open-feature/dotnet-sdk#54, open-feature/dotnet-sdk#173 Signed-off-by: Austin Drenski --- .github/workflows/ci.yml | 87 +++++++++++++++++++ .github/workflows/linux-ci.yml | 34 -------- .github/workflows/windows-ci.yml | 34 -------- CONTRIBUTING.md | 4 +- build/Common.prod.props | 13 +-- build/Common.props | 6 +- build/Common.tests.props | 2 + global.json | 6 ++ nuget.config | 22 +++++ .../OpenFeature.Contrib.Hooks.Otel.csproj | 4 +- ...Feature.Contrib.Providers.ConfigCat.csproj | 6 +- ...Contrib.Providers.FeatureManagement.csproj | 7 +- ...OpenFeature.Contrib.Providers.Flagd.csproj | 4 +- ...Feature.Contrib.Providers.Flagsmith.csproj | 4 +- ...ure.Contrib.Providers.GOFeatureFlag.csproj | 4 +- 15 files changed, 136 insertions(+), 101 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/linux-ci.yml delete mode 100644 .github/workflows/windows-ci.yml create mode 100644 global.json create mode 100644 nuget.config diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2bd68c4f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + branches: [ main ] + paths-ignore: + - '**.md' + pull_request: + branches: [ main ] + paths-ignore: + - '**.md' + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --logger GitHubActions + + packaging: + needs: build + + permissions: + contents: read + packages: write + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + + - name: Restore + run: dotnet restore + + - name: Pack NuGet packages (CI versions) + if: startsWith(github.ref, 'refs/heads/') + run: dotnet pack --no-restore --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" + + - name: Pack NuGet packages (PR versions) + if: startsWith(github.ref, 'refs/pull/') + run: dotnet pack --no-restore --version-suffix "pr.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" + + - name: Publish NuGet packages (base) + if: github.event.pull_request.head.repo.fork == false + run: dotnet nuget push "src/**/*.nupkg" --api-key "${{ secrets.GITHUB_TOKEN }}" --source https://nuget.pkg.github.com/open-feature/index.json + + - name: Publish NuGet packages (fork) + if: github.event.pull_request.head.repo.fork == true + uses: actions/upload-artifact@v4.2.0 + with: + name: nupkgs + path: src/**/*.nupkg diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml deleted file mode 100644 index 7313bea5..00000000 --- a/.github/workflows/linux-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Linux - -on: - push: - branches: [ main ] - paths-ignore: - - '**.md' - pull_request: - branches: [ main ] - paths-ignore: - - '**.md' - -jobs: - build-test: - runs-on: ubuntu-latest - - strategy: - matrix: - version: [net6.0,net7.0] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test ${{ matrix.version }} - run: dotnet test --configuration Release --no-build --logger:"console;verbosity=detailed" diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml deleted file mode 100644 index 3e29f545..00000000 --- a/.github/workflows/windows-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Windows - -on: - push: - branches: [ main ] - paths-ignore: - - '**.md' - pull_request: - branches: [ main ] - paths-ignore: - - '**.md' - -jobs: - build-test: - runs-on: windows-latest - - strategy: - matrix: - version: [net462,net6.0,net7.0] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test ${{ matrix.version }} - run: dotnet test --configuration Release --no-build --logger:"console;verbosity=detailed" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index abeb7e0b..f11d49a8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,12 +28,10 @@ Sample `.csproj` file: OpenFeature.Contrib.MyComponent 0.0.1 - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) A very valuable OpenFeature contribution! - https://openfeature.dev - https://github.com/open-feature/dotnet-sdk-contrib Me! diff --git a/build/Common.prod.props b/build/Common.prod.props index 7badf346..e41bee23 100644 --- a/build/Common.prod.props +++ b/build/Common.prod.props @@ -2,13 +2,16 @@ + true + true true + true netstandard2.0;net462;net5.0;net6.0;net7.0 git - https://github.com/open-feature/dotnet-sdk + https://github.com/open-feature/dotnet-sdk-contrib OpenFeature is an open standard for feature flag management, created to support a robust feature flag ecosystem using cloud native technologies. OpenFeature will provide a unified API and SDK, and a developer-first, cloud-native implementation, with extensibility for open source and commercial offerings. Feature;OpenFeature;Flags; openfeature-icon.png @@ -28,12 +31,4 @@ true snupkg - - - - - - - true - diff --git a/build/Common.props b/build/Common.props index fc34c474..928e20d7 100644 --- a/build/Common.props +++ b/build/Common.props @@ -27,4 +27,8 @@ [1.2,) - \ No newline at end of file + + + + + diff --git a/build/Common.tests.props b/build/Common.tests.props index 8a533a23..9f94a8e4 100644 --- a/build/Common.tests.props +++ b/build/Common.tests.props @@ -28,6 +28,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -45,6 +46,7 @@ [4.17.0] [3.1.2] [6.7.0] + [2.3.3] [17.3.2] [5.0.0] [2.4.3,3.0) diff --git a/global.json b/global.json new file mode 100644 index 00000000..0aca8b12 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "rollForward": "latestFeature", + "version": "8.0.100" + } +} diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..5a0edf43 --- /dev/null +++ b/nuget.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/OpenFeature.Contrib.Hooks.Otel/OpenFeature.Contrib.Hooks.Otel.csproj b/src/OpenFeature.Contrib.Hooks.Otel/OpenFeature.Contrib.Hooks.Otel.csproj index f413d1f7..cce45511 100644 --- a/src/OpenFeature.Contrib.Hooks.Otel/OpenFeature.Contrib.Hooks.Otel.csproj +++ b/src/OpenFeature.Contrib.Hooks.Otel/OpenFeature.Contrib.Hooks.Otel.csproj @@ -3,12 +3,10 @@ OpenFeature.Contrib.Hooks.Otel 0.1.3 - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) Open Telemetry Hook for .NET - https://openfeature.dev - https://github.com/open-feature/dotnet-sdk-contrib Florian Bacher diff --git a/src/OpenFeature.Contrib.Providers.ConfigCat/OpenFeature.Contrib.Providers.ConfigCat.csproj b/src/OpenFeature.Contrib.Providers.ConfigCat/OpenFeature.Contrib.Providers.ConfigCat.csproj index ec83a84b..82d34807 100644 --- a/src/OpenFeature.Contrib.Providers.ConfigCat/OpenFeature.Contrib.Providers.ConfigCat.csproj +++ b/src/OpenFeature.Contrib.Providers.ConfigCat/OpenFeature.Contrib.Providers.ConfigCat.csproj @@ -3,12 +3,10 @@ OpenFeature.Contrib.Providers.ConfigCat 0.0.1 - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) ConfigCat provider for .NET - https://openfeature.dev - https://github.com/open-feature/dotnet-sdk-contrib Luiz Bon @@ -20,4 +18,4 @@ - \ No newline at end of file + diff --git a/src/OpenFeature.Contrib.Providers.FeatureManagement/OpenFeature.Contrib.Providers.FeatureManagement.csproj b/src/OpenFeature.Contrib.Providers.FeatureManagement/OpenFeature.Contrib.Providers.FeatureManagement.csproj index 85ea512d..7cf292aa 100644 --- a/src/OpenFeature.Contrib.Providers.FeatureManagement/OpenFeature.Contrib.Providers.FeatureManagement.csproj +++ b/src/OpenFeature.Contrib.Providers.FeatureManagement/OpenFeature.Contrib.Providers.FeatureManagement.csproj @@ -3,12 +3,11 @@ OpenFeature.Contrib.Provider.FeatureManagement 0.0.1 - $(VersionNumber)-preview + $(VersionNumber) + preview $(VersionNumber) $(VersionNumber) An OpenFeature Provider built on top of the standard Microsoft FeatureManagement Library - https://openfeature.dev - https://github.com/open-feature/dotnet-sdk-contrib Eric Pattison @@ -16,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/OpenFeature.Contrib.Providers.Flagd/OpenFeature.Contrib.Providers.Flagd.csproj b/src/OpenFeature.Contrib.Providers.Flagd/OpenFeature.Contrib.Providers.Flagd.csproj index f73392e1..cebe1bc8 100644 --- a/src/OpenFeature.Contrib.Providers.Flagd/OpenFeature.Contrib.Providers.Flagd.csproj +++ b/src/OpenFeature.Contrib.Providers.Flagd/OpenFeature.Contrib.Providers.Flagd.csproj @@ -3,12 +3,10 @@ OpenFeature.Contrib.Providers.Flagd 0.1.7 - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) flagd provider for .NET - https://openfeature.dev - https://github.com/open-feature/dotnet-sdk-contrib Todd Baert diff --git a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj index 73aa89f6..7cb63914 100644 --- a/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj +++ b/src/OpenFeature.Contrib.Providers.Flagsmith/OpenFeature.Contrib.Providers.Flagsmith.csproj @@ -4,12 +4,10 @@ netstandard20 OpenFeature.Contrib.Providers.Flagsmith 0.1.5 - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) Flagsmith provider for .NET - https://openfeature.dev - https://github.com/open-feature/dotnet-sdk-contrib Vladimir Petrusevici diff --git a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj index 14f89391..3af2cc01 100644 --- a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj +++ b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj @@ -3,12 +3,10 @@ OpenFeature.Contrib.GOFeatureFlag 0.1.5 - $(VersionNumber) + $(VersionNumber) $(VersionNumber) $(VersionNumber) GO Feature Flag provider for .NET - https://gofeatureflag.org - https://github.com/open-feature/dotnet-sdk-contrib Thomas Poignant