Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/actions/setup-bc-devtools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ inputs:
runs:
using: composite
steps:
- name: Get source for BC Dev Tools
- name: Get BC Dev Tools for Marketplace
id: get-bc-devtools
shell: pwsh
run: |
# Retrieve source Uri from Marketplace
$sourceUri = ${{github.action_path}}/Marketplace.ps1 -Version ${{ inputs.version-number }}
echo "source-uri=$($sourceUri)" >> $env:GITHUB_OUTPUT
"source-uri=$sourceUri" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8

- name: Download BC DevTools asset
id: download-bc-devtools-asset
Expand All @@ -28,7 +28,7 @@ runs:
env:
ASSET_URI: ${{ steps.get-bc-devtools.outputs.source-uri }}
run: |
# Download BC DevTools asset
# Download BC DevTools asset
$downloadPath = ${{github.action_path}}/Download-BcDevToolsAsset.ps1 -AssetUri $env:ASSET_URI
"download-path=$downloadPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8

Expand All @@ -39,6 +39,7 @@ runs:
TARGET_PATH: ${{ inputs.target-path }}
ACTION_PATH: ${{ github.action_path }}
run: |
Write-Output "Extracting $env:ARCHIVE_PATH ..."
# Extract BC DevTools asset
Write-Output "Extracting $($env:ARCHIVE_PATH)..."

& "$env:ACTION_PATH\Extract-RequiredFiles.ps1" -DestinationPath $env:TARGET_PATH -ArchivePath $env:ARCHIVE_PATH -PathInArchive 'extension/bin/Analyzers'
114 changes: 114 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: CI/CD

on:
push:
branches: [ main, master ]
paths:
- 'src/**'
- '**/*.sln'
- '**/*.csproj'
- '**/*.props'
- '**/*.targets'
- 'Directory.Packages.props'
- 'global.json'
- 'nuget.config'
- '.config/dotnet-tools.json'
- '.github/workflows/**'
- '!**/*.md'

permissions:
contents: read
packages: write

env:
DOTNET_NOLOGO: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
cache: true
cache-dependency-path: |
**/*.csproj
**/packages.lock.json
nuget.config

- name: Setup BC DevTools - netstandard2.1
uses: ./.github/actions/setup-bc-devtools
with:
version-number: '12.0.875970'
target-path: 'Microsoft.Dynamics.BusinessCentral.Development.Tools/netstandard2.1'

- name: Setup BC DevTools - net8.0
uses: ./.github/actions/setup-bc-devtools
with:
version-number: '16.0.1463980'
target-path: 'Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0'

- name: Restore
run: dotnet restore src/RoslynTestKit.sln

- name: GitVersion - Setup
uses: gittools/actions/gitversion/setup@v3
with:
versionSpec: '5.x'

- name: GitVersion - Determine
id: gitversion
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true

- name: Pack
run: >
dotnet pack src/RoslynTestKit/RoslynTestKit.csproj
--configuration Release
--no-restore
--include-symbols
--output ./artifacts
/p:ContinuousIntegrationBuild=true
/p:EmbedUntrackedSources=true
/p:SymbolPackageFormat=snupkg
/p:RepositoryType=git
/p:RepositoryUrl=https://github.com/${{ github.repository }}
/p:RepositoryCommit=${{ steps.gitversion.outputs.Sha }}
/p:PackageVersion=${{ steps.gitversion.outputs.NuGetVersionV2 }}
/p:AssemblyVersion=${{ steps.gitversion.outputs.AssemblySemVer }}
/p:FileVersion=${{ steps.gitversion.outputs.AssemblySemFileVer }}
/p:InformationalVersion="${{ steps.gitversion.outputs.InformationalVersion }}"

- name: Validate
run: |
dotnet tool install --global dotnet-validate --version 0.0.1-preview.537
dotnet-validate package local ./artifacts/*.nupkg

- name: Publish to GitHub Packages
run: >
dotnet nuget push "./artifacts/*.nupkg"
--no-symbols
--api-key ${{ secrets.GITHUB_TOKEN }}
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
--skip-duplicate

- name: Publish to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY not configured"; exit 1
fi
dotnet nuget push ./packages/*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
102 changes: 0 additions & 102 deletions .github/workflows/pr-validation.yml

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Pull Request

on:
pull_request:
branches: [ main, master ]
paths:
- 'src/**'
- '**/*.sln'
- '**/*.csproj'
- '**/*.props'
- '**/*.targets'
- 'Directory.Packages.props'
- 'global.json'
- 'nuget.config'
- '.config/dotnet-tools.json'
- '.github/workflows/**'
- '!**/*.md'

permissions:
contents: read

env:
DOTNET_NOLOGO: true

jobs:
build-pack-validate:
name: Build, Pack and Validate
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.draft == false }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
cache: true
cache-dependency-path: |
**/*.csproj
**/packages.lock.json
nuget.config

- name: Setup BC DevTools (netstandard2.1)
uses: ./.github/actions/setup-bc-devtools
with:
version-number: '12.0.875970'
target-path: 'Microsoft.Dynamics.BusinessCentral.Development.Tools/netstandard2.1'

- name: Setup BC DevTools (net8.0)
uses: ./.github/actions/setup-bc-devtools
with:
version-number: '16.0.1463980'
target-path: 'Microsoft.Dynamics.BusinessCentral.Development.Tools/net8.0'

- name: Restore
run: dotnet restore src/RoslynTestKit.sln

- name: Build
# Disabled as 'dotnet pack' also builds the project
if: false
run: >
dotnet build src/RoslynTestKit.sln
--configuration Release
--no-restore

- name: Pack
run: >
dotnet pack src/RoslynTestKit/RoslynTestKit.csproj
--configuration Release
--no-restore
--include-symbols
--output ./artifacts
/p:ContinuousIntegrationBuild=true
/p:EmbedUntrackedSources=true
/p:SymbolPackageFormat=snupkg

- name: Validate
run: |
dotnet tool install --global dotnet-validate --version 0.0.1-preview.537
dotnet-validate package local ./artifacts/*.nupkg
Loading
Loading