diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a96f789..c7fc8be9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Test +name: CI on: push: @@ -11,44 +11,41 @@ on: - '**.md' jobs: - unit-tests-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + build: + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] - - name: Setup .NET SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 7.0.x - - - name: Run Tests - run: dotnet test test/OpenFeature.Tests/ --configuration Release --logger GitHubActions + runs-on: ${{ matrix.os }} - unit-tests-windows: - runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: fetch-depth: 0 + submodules: recursive - name: Setup .NET SDK uses: actions/setup-dotnet@v4 + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: dotnet-version: | 6.0.x 7.0.x + source-url: https://nuget.pkg.github.com/open-feature/index.json + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore - - name: Run Tests - run: dotnet test test\OpenFeature.Tests\ --configuration Release --logger GitHubActions + - name: Test + run: dotnet test --no-build --logger GitHubActions packaging: - needs: - - unit-tests-linux - - unit-tests-windows + needs: build permissions: contents: read @@ -57,14 +54,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive - name: Setup .NET SDK uses: actions/setup-dotnet@v4 + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: dotnet-version: | 6.0.x 7.0.x + source-url: https://nuget.pkg.github.com/open-feature/index.json - name: Restore run: dotnet restore diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 3fadffc8..3a409ae8 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -12,9 +12,11 @@ on: jobs: build-test-report: - runs-on: ubuntu-latest - env: - OS: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -23,13 +25,19 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + dotnet-version: | + 6.0.x + 7.0.x + source-url: https://nuget.pkg.github.com/open-feature/index.json - name: Run Test run: dotnet test --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - uses: codecov/codecov-action@v3.1.5 with: - env_vars: OS name: Code Coverage for ${{ matrix.os }} fail_ci_if_error: true verbose: true diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index c0927b60..50a0b812 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -25,10 +25,13 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: dotnet-version: | 6.0.x 7.0.x + source-url: https://nuget.pkg.github.com/open-feature/index.json - name: Initialize Tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01dc95a8..859a9078 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,10 +25,13 @@ jobs: - name: Setup .NET SDK if: ${{ steps.release.outputs.releases_created }} uses: actions/setup-dotnet@v4 + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: dotnet-version: | 6.0.x 7.0.x + source-url: https://nuget.pkg.github.com/open-feature/index.json - name: Install dependencies if: ${{ steps.release.outputs.releases_created }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77eef66a..9f8cf33c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -155,3 +155,38 @@ dotnet restore dotnet build --configuration Release --output "./release" --no-restore dotnet release/OpenFeature.Benchmarks.dll ``` + +## Consuming pre-release packages + +1. Acquire a [GitHub personal access token (PAT)](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) scoped for `read:packages` and verify the permissions: + ```console + $ gh auth login --scopes read:packages + + ? What account do you want to log into? GitHub.com + ? What is your preferred protocol for Git operations? HTTPS + ? How would you like to authenticate GitHub CLI? Login with a web browser + + ! First copy your one-time code: ****-**** + Press Enter to open github.com in your browser... + + ✓ Authentication complete. + - gh config set -h github.com git_protocol https + ✓ Configured git protocol + ✓ Logged in as ******** + ``` + + ```console + $ gh auth status + + github.com + ✓ Logged in to github.com as ******** (~/.config/gh/hosts.yml) + ✓ Git operations for github.com configured to use https protocol. + ✓ Token: gho_************************************ + ✓ Token scopes: gist, read:org, read:packages, repo, workflow + ``` +2. Run the following command to configure your local environment to consume packages from GitHub Packages: + ```console + $ dotnet nuget update source github-open-feature --username $(gh api user --jq .email) --password $(gh auth token) --store-password-in-clear-text + + Package source "github-open-feature" was successfully updated. + ``` diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..5a0edf43 --- /dev/null +++ b/nuget.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + +