feat: Add Dependency Injection support #2694
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: | |
- name | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
branches: | |
- main | |
merge_group: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
pull-requests: write | |
packages: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
global-json-file: global.json | |
source-url: https://nuget.pkg.github.com/open-feature/index.json | |
- name: Cache NuGet packages | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --logger GitHubActions | |
e2e: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
packages: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
global-json-file: global.json | |
source-url: https://nuget.pkg.github.com/open-feature/index.json | |
- name: Test | |
run: dotnet build && E2E=true dotnet test --logger GitHubActions | |
packaging: | |
needs: build | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
global-json-file: global.json | |
source-url: https://nuget.pkg.github.com/open-feature/index.json | |
- name: Cache NuGet packages | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- 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 --skip-duplicate | |
- name: Publish NuGet packages (fork) | |
if: github.event.pull_request.head.repo.fork == true | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: nupkgs | |
path: src/**/*.nupkg |