-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
The workflows in this repository try to follow existing, basic samples with little customization. | ||
|
||
## main.yml | ||
We use a standard dotnet build/test/pack workflow | ||
https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | ||
|
||
- Build the solution using the dotnet cli | ||
- Strong name the assemblies using a key stored in the repository | ||
https://github.com/dotnet/runtime/blob/main/docs/project/strong-name-signing.md | ||
- Test the built libraries | ||
- Use a repository secret to hold the OpenAI token used for live testing | ||
https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions | ||
- Package the built libraries | ||
- Publish the package as a GitHub Release | ||
- Publish the package to a GitHub NuGet registry | ||
https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry | ||
- Publish a single build artifact containing test results and a nuget package |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Build and Test | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
build: # Test, pack and publish the Open AI nuget package as a build artifact | ||
runs-on: ubuntu-latest | ||
env: | ||
version_suffix_args: ${{ format('--version-suffix="alpha.{0}"', github.run_number) }} | ||
steps: | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.x | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build | ||
run: dotnet build | ||
-c Release | ||
${{ env.version_suffix_args }} | ||
working-directory: .dotnet | ||
|
||
- name: Test | ||
run: dotnet test | ||
--no-build | ||
--configuration Release | ||
--filter="TestCategory~${{ github.event_name == 'pull_request' && 'Offline' || 'Online' }}" | ||
--logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx" | ||
env: | ||
SECRET_VALUE: ${{ secrets.OPENAI_TOKEN }} | ||
working-directory: .dotnet | ||
|
||
- name: Pack | ||
run: dotnet pack | ||
--no-build | ||
--configuration Release | ||
--output "${{github.workspace}}/artifacts/packages" | ||
${{ env.version_suffix_args }} | ||
working-directory: .dotnet | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-artifacts | ||
path: ${{github.workspace}}/artifacts | ||
|
||
- name: NuGet Autenticate | ||
if: github.event_name != 'pull_request' | ||
run: dotnet nuget add source | ||
"https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" | ||
--name "github" | ||
--username ${{ github.actor }} | ||
--password ${{ secrets.GITHUB_TOKEN }} | ||
--store-password-in-clear-text | ||
working-directory: .dotnet | ||
|
||
- name: Publish | ||
if: github.event_name != 'pull_request' | ||
run: dotnet nuget push | ||
${{github.workspace}}/artifacts/packages/*.nupkg | ||
--source "github" | ||
--api-key ${{ secrets.GITHUB_TOKEN }} | ||
--skip-duplicate | ||
working-directory: .dotnet |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Release package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '8.x' # SDK Version to use. | ||
|
||
- name: Build | ||
run: dotnet build | ||
-c Release | ||
working-directory: .dotnet | ||
|
||
- name: Test | ||
run: dotnet test | ||
--no-build | ||
--configuration Release | ||
--filter="TestCategory~Online" | ||
--logger "trx;LogFileName=${{github.workspace}}/artifacts/test-results/full.trx" | ||
env: | ||
SECRET_VALUE: ${{ secrets.OPENAI_TOKEN }} | ||
working-directory: .dotnet | ||
|
||
# Pack the client nuget package and include urls back to the repository and release tag | ||
- name: Pack | ||
run: dotnet pack | ||
--no-build | ||
--configuration Release | ||
--output "${{github.workspace}}/artifacts/packages" | ||
/p:RepositoryUrl="${{ github.repository }}" | ||
/p:PackageProjectUrl="${{ github.repository }}/tree/${{ github.event.release.tag_name }}" | ||
working-directory: .dotnet | ||
|
||
# Append the nuget package to the github release that triggered this workflow | ||
- name: Upload release asset | ||
run: gh release upload ${{ github.event.release.tag_name }} | ||
${{github.workspace}}/artifacts/packages/*.nupkg | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-artifacts | ||
path: ${{github.workspace}}/artifacts | ||
|
||
- name: NuGet Autenticate | ||
run: dotnet nuget add source | ||
"https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" | ||
--name "github" | ||
--username ${{ github.actor }} | ||
--password ${{ secrets.GITHUB_TOKEN }} | ||
--store-password-in-clear-text | ||
working-directory: .dotnet | ||
|
||
# - name: Publish | ||
# run: dotnet nuget push | ||
# ${{github.workspace}}/artifacts/packages/*.nupkg | ||
# --source "github" | ||
# --api-key ${{ secrets.GITHUB_TOKEN }} | ||
# --skip-duplicate | ||
# working-directory: .dotnet |