Skip to content

Commit

Permalink
Enabling CI/CD
Browse files Browse the repository at this point in the history
- Runs Build, Test, Signing checks on PR
- Deploys signed VSIX to Markeplace on merge to main
- Adds CODEOWNERS
- Updates README w/ some nice badges
  • Loading branch information
bc3tech committed Jun 13, 2024
1 parent c1afd46 commit 19ec7ff
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @bc3tech @brandonh-msft
99 changes: 84 additions & 15 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,106 @@ on:
- main
workflow_dispatch:
workflow_call:
outputs:
extVersion:
value: ${{ jobs.package-extension.outputs.extVersion }}

env:
EXTENSION_VERSION: 1.0.${{ github.run_number }}

jobs:
build-and-test:
run-tests:
runs-on: ubuntu-latest

steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"

- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false

- name: Run unit tests
run: dotnet test ./DocGpt.Test/DocGpt.Test.csproj --configuration Release

package-extension:
# VS extension packaging requires netfx, so have to run it on Windows
runs-on: windows-latest
outputs:
extVersion: ${{ env.EXTENSION_VERSION }}

steps:
- name: Setup MSBuild for NetFX
uses: microsoft/setup-msbuild@v2
with:
vs-version: 17.0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: Install sign tool
run: dotnet tool install --tool-path ./sign sign

- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false

- name: Bump version
run: |
# Use PowerShell to update the version in the VSIX manifest
$xml = [xml](Get-Content -Path .\DocGpt.Vsix\source.extension.vsixmanifest)
$identityNode = $xml.PackageManifest.Metadata.Identity
$identityNode.SetAttribute('Version', $env:EXTENSION_VERSION)
$xml.Save(".\DocGpt.Vsix\source.extension.vsixmanifest")
echo "extVersion=$env:EXTENSION_VERSION" >> "$env:GITHUB_OUTPUT"
- name: Restore NuGet packages
run: nuget restore ./DocGpt.sln
run: nuget restore .\DocGpt.sln

- name: Run unit tests
run: dotnet test ./DocGpt.Test/DocGpt.Test.csproj --configuration Release

- name: Build Extension
run: msbuild ./DocGpt.sln -p:Configuration=Release -t:Rebuild
run: msbuild .\DocGpt.sln -p:Configuration=Release

- name: Store unsigned artifact
uses: actions/upload-artifact@v4
with:
name: DocGPT-unsigned.vsix
path: DocGpt.Vsix\bin\Release\DocGPT.vsix
retention-days: 1

sign-extension:
needs: package-extension
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
sparse-checkout: |
lib/linux
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: DocGPT-unsigned.vsix
path: ./o

# TODO: Switch from prerelease when they ship a release version
- name: Sign Extension
run: lib\win\openvsixsigntool.exe sign -t "http://timestamp.digicert.com" ".\DocGpt.Vsix\bin\Release\DocGPT.vsix" -kvu "https://${{ secrets.AZURE_KEYVAULT_NAME }}.vault.azure.net" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc "${{ secrets.SIGNING_CERTIFICATE_NAME }}"
run: |
dotnet tool install --tool-path signer sign --prerelease
./signer/sign code azure-key-vault `
-t "http://timestamp.digicert.com" "./o/DocGPT.vsix" `
-kvu "https://${{ secrets.AZURE_KEYVAULT_NAME }}.vault.azure.net" `
-kvt "${{ secrets.AZURE_TENANT_ID }}" `
-kvi "${{ secrets.AZURE_CLIENT_ID }}" `
-kvs "${{ secrets.AZURE_CLIENT_SECRET }}" `
-kvc "${{ secrets.SIGNING_CERTIFICATE_NAME }}" `
-d "DocGPT CodeSign Certificate" `
-u "https://bc3.tech/docgpt"
- name: Publish signed artifact
uses: actions/upload-artifact@v4
with:
name: DocGPT-signed.vsix
path: ./o/DocGPT.vsix
52 changes: 37 additions & 15 deletions .github/workflows/publish-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,74 @@ on:
- main
workflow_dispatch:

env:
EXTENSION_VERSION: 1.0.${{ github.run_number }}

jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
secrets: inherit

publish-to-marketplace:
needs: build-and-test
runs-on: ubuntu-latest
runs-on: windows-latest
env:
EXTENSION_VERSION: ${{ needs.build-and-test.outputs.extVersion }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
sparse-checkout: |
DocGpt.Vsix/publishmanifest.json
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: DocGPT.vsix
path: ./DocGPT.vsix
name: DocGPT-signed.vsix
path: .\o

- name: Publish to marketplace
uses: cezarypiatek/VsixPublisherAction@1.1
with:
extension-file: ./DocGPT.vsix
publish-manifest-file: ./DocGpt.Vsix/publishmanifest.json
extension-file: .\o\DocGPT.vsix
publish-manifest-file: .\DocGpt.Vsix\publishmanifest.json
personal-access-code: ${{ secrets.MARKETPLACE_PAT }}

publish-release:

publish-gh-release:
needs: build-and-test
runs-on: ubuntu-latest
permissions: write-all
env:
EXTENSION_VERSION: ${{ needs.build-and-test.outputs.extVersion }}
GH_TOKEN: ${{ github.token }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
show-progress: false
sparse-checkout: |
README.md
- name: Create tag
run: |
git -c user.name="GitHub Actions" -c user.email="actions@github.com" tag "v${{ env.EXTENSION_VERSION }}" "${{ github.sha }}"
git push --tags origin
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: DocGPT.vsix
path: ./DocGPT.vsix
name: DocGPT-signed.vsix
path: ./o

- name: Create Release
run: |
gh release create --target "${{ github.sha }}" \
--title "v${{ env.EXTENSION_VERSION }}" \
--generate-notes
gh release create "v${{ env.EXTENSION_VERSION }}" \
--generate-notes \
--draft
- name: Upload Release Asset
run: |
gh release upload "v${{ env.EXTENSION_VERSION }}" \
--file ./DocGPT.vsix#Installer \
./o/DocGPT.vsix#Installer \
--clobber
13 changes: 13 additions & 0 deletions DocGpt.Vsix/publishmanifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json.schemastore.org/vsix-publish",
"categories": ["coding", "documentation", "other"],
"identity": {
"internalName": "net-bc3tech-docgpt"
},
"overview": "../README.md",
"priceCategory": "free",
"publisher": "bc3tech",
"private": false,
"qna": false,
"repo": "https://github.com/bc3tech/docgpt"
}
2 changes: 1 addition & 1 deletion DocGpt.Vsix/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<GettingStartedGuide>README.md</GettingStartedGuide>
<Icon>icon.jpg</Icon>
<PreviewImage>demo.gif</PreviewImage>
<Tags>dotnet, gpt, llm, ai, xmldoc, xml, documentation, openai, azure</Tags>
<Tags>dotnet;gpt;llm;ai;xmldoc;xml;documentation;openai;azure</Tags>
</Metadata>
<Installation>
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Community">
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Doc GPT

# Doc GPT

| [![Repo health indicator](https://img.shields.io/github/actions/workflow/status/bc3tech/docgpt/build-and-test.yml?style=for-the-badge)](https://github.com/bc3tech/docgpt/actions/workflows/build-and-test.yml) | ![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/bc3tech/docgpt/main?style=for-the-badge) |
|---:|:---|
| [![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/bc3tech.net-bc3tech-docgpt?style=for-the-badge&logo=visualstudioappcenter&label=Latest%20Version)](https://marketplace.visualstudio.com/items?itemName=bc3tech.net-bc3tech-docgpt) | ![Visual Studio Marketplace Last Updated](https://img.shields.io/visual-studio-marketplace/last-updated/bc3tech.net-bc3tech-docgpt?style=for-the-badge)
| ![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/bc3tech.net-bc3tech-docgpt?style=for-the-badge) | ![Visual Studio Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/bc3tech.net-bc3tech-docgpt?style=for-the-badge)

A Visual Studio extension to quickly and easily document your code using LLMs.

Expand All @@ -7,6 +13,7 @@ A Visual Studio extension to quickly and easily document your code using LLMs.
- Install the extension **free** from [the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=bc3tech.net-bc3tech-docgpt) or from within Visual Studio's extension manager

## Configuration

- Set up the endpoint for your OpenAI model in the extension's settings
![VS Options panel for Doc GPT](docs/img/options_panel.png)

Expand Down

0 comments on commit 19ec7ff

Please sign in to comment.