Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 130654b

Browse files
authoredJan 27, 2024
chore: Sync ci.yml with contrib repo (#196)
Signed-off-by: Austin Drenski <[email protected]>
1 parent bac3d94 commit 130654b

File tree

6 files changed

+104
-29
lines changed

6 files changed

+104
-29
lines changed
 

Diff for: ‎.github/workflows/ci.yml

+29-25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: CI
22

33
on:
44
push:
@@ -11,44 +11,41 @@ on:
1111
- '**.md'
1212

1313
jobs:
14-
unit-tests-linux:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
14+
build:
15+
strategy:
16+
matrix:
17+
os: [ ubuntu-latest, windows-latest ]
2018

21-
- name: Setup .NET SDK
22-
uses: actions/setup-dotnet@v4
23-
with:
24-
dotnet-version: |
25-
6.0.x
26-
7.0.x
27-
28-
- name: Run Tests
29-
run: dotnet test test/OpenFeature.Tests/ --configuration Release --logger GitHubActions
19+
runs-on: ${{ matrix.os }}
3020

31-
unit-tests-windows:
32-
runs-on: windows-latest
3321
steps:
34-
- uses: actions/checkout@v4
22+
- name: Checkout
23+
uses: actions/checkout@v4
3524
with:
3625
fetch-depth: 0
26+
submodules: recursive
3727

3828
- name: Setup .NET SDK
3929
uses: actions/setup-dotnet@v4
30+
env:
31+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4032
with:
4133
dotnet-version: |
4234
6.0.x
4335
7.0.x
36+
source-url: https://nuget.pkg.github.com/open-feature/index.json
37+
38+
- name: Restore
39+
run: dotnet restore
40+
41+
- name: Build
42+
run: dotnet build --no-restore
4443

45-
- name: Run Tests
46-
run: dotnet test test\OpenFeature.Tests\ --configuration Release --logger GitHubActions
44+
- name: Test
45+
run: dotnet test --no-build --logger GitHubActions
4746

4847
packaging:
49-
needs:
50-
- unit-tests-linux
51-
- unit-tests-windows
48+
needs: build
5249

5350
permissions:
5451
contents: read
@@ -57,14 +54,21 @@ jobs:
5754
runs-on: ubuntu-latest
5855

5956
steps:
60-
- uses: actions/checkout@v4
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
submodules: recursive
6162

6263
- name: Setup .NET SDK
6364
uses: actions/setup-dotnet@v4
65+
env:
66+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6467
with:
6568
dotnet-version: |
6669
6.0.x
6770
7.0.x
71+
source-url: https://nuget.pkg.github.com/open-feature/index.json
6872

6973
- name: Restore
7074
run: dotnet restore

Diff for: ‎.github/workflows/code-coverage.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ on:
1212

1313
jobs:
1414
build-test-report:
15-
runs-on: ubuntu-latest
16-
env:
17-
OS: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ ubuntu-latest, windows-latest ]
18+
19+
runs-on: ${{ matrix.os }}
1820

1921
steps:
2022
- uses: actions/checkout@v4
@@ -23,13 +25,19 @@ jobs:
2325

2426
- name: Setup .NET SDK
2527
uses: actions/setup-dotnet@v4
28+
env:
29+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
dotnet-version: |
32+
6.0.x
33+
7.0.x
34+
source-url: https://nuget.pkg.github.com/open-feature/index.json
2635

2736
- name: Run Test
2837
run: dotnet test --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
2938

3039
- uses: codecov/codecov-action@v3.1.5
3140
with:
32-
env_vars: OS
3341
name: Code Coverage for ${{ matrix.os }}
3442
fail_ci_if_error: true
3543
verbose: true

Diff for: ‎.github/workflows/e2e.yml

+3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ jobs:
2525

2626
- name: Setup .NET SDK
2727
uses: actions/setup-dotnet@v4
28+
env:
29+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2830
with:
2931
dotnet-version: |
3032
6.0.x
3133
7.0.x
34+
source-url: https://nuget.pkg.github.com/open-feature/index.json
3235

3336
- name: Initialize Tests
3437
run: |

Diff for: ‎.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ jobs:
2525
- name: Setup .NET SDK
2626
if: ${{ steps.release.outputs.releases_created }}
2727
uses: actions/setup-dotnet@v4
28+
env:
29+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2830
with:
2931
dotnet-version: |
3032
6.0.x
3133
7.0.x
34+
source-url: https://nuget.pkg.github.com/open-feature/index.json
3235

3336
- name: Install dependencies
3437
if: ${{ steps.release.outputs.releases_created }}

Diff for: ‎CONTRIBUTING.md

+35
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,38 @@ dotnet restore
155155
dotnet build --configuration Release --output "./release" --no-restore
156156
dotnet release/OpenFeature.Benchmarks.dll
157157
```
158+
159+
## Consuming pre-release packages
160+
161+
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:
162+
```console
163+
$ gh auth login --scopes read:packages
164+
165+
? What account do you want to log into? GitHub.com
166+
? What is your preferred protocol for Git operations? HTTPS
167+
? How would you like to authenticate GitHub CLI? Login with a web browser
168+
169+
! First copy your one-time code: ****-****
170+
Press Enter to open github.com in your browser...
171+
172+
✓ Authentication complete.
173+
- gh config set -h github.com git_protocol https
174+
✓ Configured git protocol
175+
✓ Logged in as ********
176+
```
177+
178+
```console
179+
$ gh auth status
180+
181+
github.com
182+
✓ Logged in to github.com as ******** (~/.config/gh/hosts.yml)
183+
✓ Git operations for github.com configured to use https protocol.
184+
✓ Token: gho_************************************
185+
✓ Token scopes: gist, read:org, read:packages, repo, workflow
186+
```
187+
2. Run the following command to configure your local environment to consume packages from GitHub Packages:
188+
```console
189+
$ dotnet nuget update source github-open-feature --username $(gh api user --jq .email) --password $(gh auth token) --store-password-in-clear-text
190+
191+
Package source "github-open-feature" was successfully updated.
192+
```

Diff for: ‎nuget.config

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<configuration>
4+
5+
<packageSources>
6+
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
7+
<add key="github-open-feature" value="https://nuget.pkg.github.com/open-feature/index.json" />
8+
</packageSources>
9+
10+
<packageSourceMapping>
11+
<packageSource key="nuget">
12+
<package pattern="OpenFeature" />
13+
<package pattern="OpenFeature.*" />
14+
<package pattern="*" />
15+
</packageSource>
16+
<packageSource key="github-open-feature">
17+
<package pattern="OpenFeature" />
18+
<package pattern="OpenFeature.*" />
19+
</packageSource>
20+
</packageSourceMapping>
21+
22+
</configuration>

0 commit comments

Comments
 (0)
Please sign in to comment.