Skip to content

Commit

Permalink
chore: Sync ci.yml with contrib repo
Browse files Browse the repository at this point in the history
Follows open-feature#173 and open-feature/dotnet-sdk-contrib#134 to synchronize
ci.yml between both repos.

```console
$ diff dotnet-sdk{,-contrib}/.github/workflows/ci.yml

```

Signed-off-by: Austin Drenski <austin@austindrenski.io>
  • Loading branch information
austindrenski committed Jan 22, 2024
1 parent 26cd5cd commit 780aac3
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 25 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: CI

on:
push:
Expand All @@ -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
Expand All @@ -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
Expand Down
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```
22 changes: 22 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>

<configuration>

<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="github-open-feature" value="https://nuget.pkg.github.com/open-feature/index.json" />
</packageSources>

<packageSourceMapping>
<packageSource key="nuget">
<package pattern="OpenFeature" />
<package pattern="OpenFeature.*" />
<package pattern="*" />
</packageSource>
<packageSource key="github-open-feature">
<package pattern="OpenFeature" />
<package pattern="OpenFeature.*" />
</packageSource>
</packageSourceMapping>

</configuration>

0 comments on commit 780aac3

Please sign in to comment.