Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor project structure to improve build and release processes #78

Merged
merged 19 commits into from
Dec 19, 2024
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
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ dotnet_style_predefined_type_for_member_access = true:suggestion
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
Expand All @@ -72,7 +72,7 @@ dotnet_naming_style.static_prefix_style.capitalization = camel_case
# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: ci
name: ci-obfuscator-cli
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main ]
paths: [ 'src/Dax.Vpax.Obfuscator.CLI/**' ]
env:
SOLUTION: Dax.Vpax.Obfuscator.CLI.slnf
jobs:
build-and-test:
runs-on: windows-latest
Expand All @@ -17,8 +21,8 @@ jobs:
6.0.x
global-json-file: global.json
- name: restore
run: dotnet restore Dax.Vpax.Obfuscator.CI.slnf
run: dotnet restore ${{ env.SOLUTION }}
- name: dotnet build
run: dotnet build Dax.Vpax.Obfuscator.CI.slnf --configuration Release --no-restore
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore
- name: dotnet test
run: dotnet test Dax.Vpax.Obfuscator.CI.slnf --configuration Release --no-build
run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-build
26 changes: 26 additions & 0 deletions .github/workflows/ci-obfuscator-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ci-obfuscator-common
on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main ]
paths: [ 'src/Dax.Vpax.Obfuscator.Common/**' ]
env:
SOLUTION: Dax.Vpax.Obfuscator.Common.slnf
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: restore
run: dotnet restore ${{ env.SOLUTION }}
- name: dotnet build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore
- name: dotnet test
run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-build
28 changes: 28 additions & 0 deletions .github/workflows/ci-obfuscator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci-obfuscator
on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main ]
paths: [ 'src/Dax.Vpax.Obfuscator/**', 'src/Dax.Tokenizer/**' ]
env:
SOLUTION: Dax.Vpax.Obfuscator.slnf
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
global-json-file: global.json
- name: restore
run: dotnet restore ${{ env.SOLUTION }}
- name: dotnet build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore
- name: dotnet test
run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-build
15 changes: 9 additions & 6 deletions .github/workflows/release-obfuscator-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: release-obfuscator-cli
on:
workflow_dispatch:
env:
PROJECT: Dax.Vpax.Obfuscator.CLI
PROJECT_NAME: Dax.Vpax.Obfuscator.CLI
PROJECT_PATH: src/Dax.Vpax.Obfuscator.CLI
PROJECT_FILE: Dax.Vpax.Obfuscator.CLI.csproj
jobs:
publish-release:
publish:
#if: github.ref == 'refs/heads/main'
runs-on: windows-latest # windows is required for code signing (AzureSignTool)
permissions:
contents: write
Expand All @@ -21,9 +24,9 @@ jobs:
uses: dotnet/[email protected]
id: nbgv
with:
path: src/${{ env.PROJECT }}
path: ${{ env.PROJECT_PATH }}
- name: dotnet publish
run: dotnet publish 'src/${{ env.PROJECT }}/${{ env.PROJECT }}.csproj' -o . -c Release -r win-x86 --sc -p:PublishSingleFile=true
run: dotnet publish -c Release -o . -r win-x86 --sc -p:PublishSingleFile=true '${{ env.PROJECT_PATH }}/${{ env.PROJECT_FILE }}'
- name: dotnet tool install AzureSignTool
run: dotnet tool install --no-cache --global AzureSignTool
- name: code signing
Expand All @@ -32,8 +35,8 @@ jobs:
- name: gh release create
shell: bash
run: |
RELEASE_TAG=${{ env.PROJECT_NAME }}_${{ steps.nbgv.outputs.SemVer2 }}
PRERELEASE_FLAG=$([[ "${{ steps.nbgv.outputs.PrereleaseVersion }}" != "" ]] && echo "--prerelease" || echo "")
gh release create ${{ env.RELEASE_TAG }} 'vpax-obfuscator.exe#Obfuscator CLI x86 net6.0' --title ${{ env.RELEASE_TAG }} --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG
gh release create $RELEASE_TAG 'vpax-obfuscator.exe#Obfuscator CLI x86 net6.0' --title $RELEASE_TAG --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG
env:
RELEASE_TAG: ${{ env.PROJECT }}_${{ steps.nbgv.outputs.SemVer2 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 10 additions & 9 deletions .github/workflows/release-obfuscator-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: release-obfuscator-common
on:
workflow_dispatch:
env:
PROJECT: Dax.Vpax.Obfuscator.Common
PROJECT_NAME: Dax.Vpax.Obfuscator.Common
PROJECT_PATH: src/Dax.Vpax.Obfuscator.Common
PROJECT_FILE: Dax.Vpax.Obfuscator.Common.csproj
jobs:
publish-release:
publish:
#if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -21,17 +24,15 @@ jobs:
uses: dotnet/[email protected]
id: nbgv
with:
path: src/${{ env.PROJECT }}
path: ${{ env.PROJECT_PATH }}
- name: dotnet pack
run: dotnet pack -c Release 'src/${{ env.PROJECT }}/${{ env.PROJECT }}.csproj'
run: dotnet pack -c Release -o . '${{ env.PROJECT_PATH }}/${{ env.PROJECT_FILE }}'
- name: nuget push
run: dotnet nuget push '${{ env.NUPKG_PATH }}' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json
env:
NUPKG_PATH: 'src/artifacts/package/release/${{ env.PROJECT }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg'
run: dotnet nuget push '${{ env.PROJECT_NAME }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json
- name: create release
run: |
RELEASE_TAG=${{ env.PROJECT_NAME }}_${{ steps.nbgv.outputs.NuGetPackageVersion }}
PRERELEASE_FLAG=$([[ "${{ steps.nbgv.outputs.PrereleaseVersion }}" != "" ]] && echo "--prerelease" || echo "")
gh release create ${{ env.RELEASE_TAG }} --title ${{ env.RELEASE_TAG }} --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG
gh release create $RELEASE_TAG --title $RELEASE_TAG --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG
env:
RELEASE_TAG: ${{ env.PROJECT }}_${{ steps.nbgv.outputs.NuGetPackageVersion }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 10 additions & 9 deletions .github/workflows/release-obfuscator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: release-obfuscator
on:
workflow_dispatch:
env:
PROJECT: Dax.Vpax.Obfuscator
PROJECT_NAME: Dax.Vpax.Obfuscator
PROJECT_PATH: src/Dax.Vpax.Obfuscator
PROJECT_FILE: Dax.Vpax.Obfuscator.csproj
jobs:
publish-release:
publish:
#if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -21,17 +24,15 @@ jobs:
uses: dotnet/[email protected]
id: nbgv
with:
path: src/${{ env.PROJECT }}
path: ${{ env.PROJECT_PATH }}
- name: dotnet pack
run: dotnet pack -c Release 'src/${{ env.PROJECT }}/${{ env.PROJECT }}.csproj'
run: dotnet pack -c Release -o . '${{ env.PROJECT_PATH }}/${{ env.PROJECT_FILE }}'
- name: nuget push
run: dotnet nuget push '${{ env.NUPKG_PATH }}' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json
env:
NUPKG_PATH: 'src/artifacts/package/release/${{ env.PROJECT }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg'
run: dotnet nuget push '${{ env.PROJECT_NAME }}.${{ steps.nbgv.outputs.NuGetPackageVersion }}.nupkg' -k '${{ secrets.NUGET_API_KEY }}' -s https://api.nuget.org/v3/index.json
- name: create release
run: |
RELEASE_TAG=${{ env.PROJECT_NAME }}_${{ steps.nbgv.outputs.NuGetPackageVersion }}
PRERELEASE_FLAG=$([[ "${{ steps.nbgv.outputs.PrereleaseVersion }}" != "" ]] && echo "--prerelease" || echo "")
gh release create ${{ env.RELEASE_TAG }} --title ${{ env.RELEASE_TAG }} --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG
gh release create $RELEASE_TAG --title $RELEASE_TAG --target $GITHUB_SHA --generate-notes --draft $PRERELEASE_FLAG
env:
RELEASE_TAG: ${{ env.PROJECT }}_${{ steps.nbgv.outputs.NuGetPackageVersion }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 0 additions & 13 deletions Dax.Vpax.Obfuscator.CI.slnf

This file was deleted.

8 changes: 8 additions & 0 deletions Dax.Vpax.Obfuscator.CLI.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"solution": {
"path": "Vpax-Obfuscator.sln",
"projects": [
"src\\Dax.Vpax.Obfuscator.CLI\\Dax.Vpax.Obfuscator.CLI.csproj"
]
}
}
9 changes: 9 additions & 0 deletions Dax.Vpax.Obfuscator.Common.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"solution": {
"path": "Vpax-Obfuscator.sln",
"projects": [
"src\\Dax.Vpax.Obfuscator.Common\\Dax.Vpax.Obfuscator.Common.csproj",
"tests\\Dax.Vpax.Obfuscator.Common.Tests\\Dax.Vpax.Obfuscator.Common.Tests.csproj"
]
}
}
10 changes: 10 additions & 0 deletions Dax.Vpax.Obfuscator.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"solution": {
"path": "Vpax-Obfuscator.sln",
"projects": [
"src\\Dax.Tokenizer\\Dax.Tokenizer.csproj",
"src\\Dax.Vpax.Obfuscator\\Dax.Vpax.Obfuscator.csproj",
"tests\\Dax.Vpax.Obfuscator.Tests\\Dax.Vpax.Obfuscator.Tests.csproj"
]
}
}
14 changes: 7 additions & 7 deletions Dax.Vpax.Obfuscator.sln → Vpax-Obfuscator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dax.Vpax.Obfuscator", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dax.Vpax.Obfuscator.Tests", "tests\Dax.Vpax.Obfuscator.Tests\Dax.Vpax.Obfuscator.Tests.csproj", "{4D99AE7D-8A59-41A2-A8C3-8054E57C1182}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dax.Vpax.Obfuscator.TestApp", "src\Dax.Vpax.Obfuscator.TestApp\Dax.Vpax.Obfuscator.TestApp.csproj", "{F20265D8-1301-4698-9D3A-A371F75CF87D}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{3302F148-E215-4823-8929-45C8A12C7E7E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{3302F148-E215-4823-8929-45C8A12C7E7E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "tools\TestApp\TestApp.csproj", "{D1B5488A-B89A-41D5-964F-D2F38B00376A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -49,16 +49,16 @@ Global
{4D99AE7D-8A59-41A2-A8C3-8054E57C1182}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D99AE7D-8A59-41A2-A8C3-8054E57C1182}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D99AE7D-8A59-41A2-A8C3-8054E57C1182}.Release|Any CPU.Build.0 = Release|Any CPU
{F20265D8-1301-4698-9D3A-A371F75CF87D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F20265D8-1301-4698-9D3A-A371F75CF87D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F20265D8-1301-4698-9D3A-A371F75CF87D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F20265D8-1301-4698-9D3A-A371F75CF87D}.Release|Any CPU.Build.0 = Release|Any CPU
{D1B5488A-B89A-41D5-964F-D2F38B00376A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1B5488A-B89A-41D5-964F-D2F38B00376A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1B5488A-B89A-41D5-964F-D2F38B00376A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1B5488A-B89A-41D5-964F-D2F38B00376A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F20265D8-1301-4698-9D3A-A371F75CF87D} = {3302F148-E215-4823-8929-45C8A12C7E7E}
{D1B5488A-B89A-41D5-964F-D2F38B00376A} = {3302F148-E215-4823-8929-45C8A12C7E7E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BF417AA2-7521-408B-A3F5-A20CC760AE6E}
Expand Down
7 changes: 6 additions & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
9 changes: 9 additions & 0 deletions scripts/prepare-release.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off

rem Script to prepare a new release using the dotnet tool nbgv.
rem Ensure nbgv is installed before running this script. Install it using `dotnet tool install -g nbgv`

echo Running nbgv prepare-release...
nbgv prepare-release --format json --commit-message-pattern "chore(release): bump version to {0}" || exit /b 1

echo Release preparation is complete. IMPORTANT: Don't forget to push the newly created release branch.
3 changes: 2 additions & 1 deletion src/Dax.Tokenizer/Dax.Tokenizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);CA1852</NoWarn>
</PropertyGroup>

<PropertyGroup>
<Authors>Tabular Editor ApS</Authors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Antlr4.Runtime.Standard" Version="4.13.1" />
<PackageReference Include="Antlr4.Runtime.Standard" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions src/Dax.Tokenizer/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "<Pending>", Scope = "type", Target = "~T:Dax.Tokenizer.DaxCharStream")]
[assembly: SuppressMessage("Naming", "CA1708:Identifiers should differ by more than case", Justification = "<Pending>", Scope = "type", Target = "~T:Dax.Tokenizer.DaxToken")]
6 changes: 3 additions & 3 deletions src/Dax.Tokenizer/version.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.0",
"nugetPackageVersion": {
"semVer": 2.0
"semVer": 2
},
"publicReleaseRefSpec": [
"^refs/heads/main"
"^refs/heads/main$"
],
"pathFilters": [
"./"
Expand Down
4 changes: 2 additions & 2 deletions src/Dax.Vpax.Obfuscator.CLI/Dax.Vpax.Obfuscator.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dax.Vpax.Obfuscator" Version="1.1.3" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Dax.Vpax.Obfuscator" />
<PackageReference Include="System.CommandLine" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Dax.Vpax.Obfuscator.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Dax.Vpax.Obfuscator.CLI;

internal class Program
internal sealed class Program
{
public static int Main(string[] args) => BuildCommand().Invoke(args);

Expand Down
Loading
Loading