-
Notifications
You must be signed in to change notification settings - Fork 0
Refactoring brew commands. Upgraded nuget refs. Add GitHub workflows and build support #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b3438c5
Refactored CLI commands to organize Homebrew and UserDefaults subcomm…
darthsharp e1b3c93
Refactored CLI commands and project structure; introduced `Directory.…
darthsharp 730d20f
Refactored console output handling in `BrewListInstalledSoftwareComma…
darthsharp ec44c8d
Added descriptions to CLI commands for Homebrew and UserDefaults func…
darthsharp dc1a270
Enhanced validation in `BrewUpgradeOptions` to enforce mutual exclusi…
darthsharp 719bd6a
Refactored outdated formula detection in `BrewInstalledModelExtension…
darthsharp e23466d
Added build system integration using CreativeCoders.CakeBuild, implem…
darthsharp cae628d
Added cross-platform build scripts (`build.cmd`, `build.sh`, `build.p…
darthsharp ca32930
Updated GitHub Actions workflow environment variables for NuGet publi…
darthsharp d104c91
Added `Directory.Build.props` to `samples` and `tests` for shared pro…
darthsharp db536a0
Added `Publish: cli dist package` step to GitHub Actions workflows fo…
darthsharp d365460
Updated dependencies across projects and refactored `BrewUpgradeComma…
darthsharp 3c70d46
Improved `FormulaeVersionsAreEqual` to handle `null` values in versio…
darthsharp 5a85f61
Simplified null-check logic in `FormulaeVersionsAreEqual`.
darthsharp 9a352b9
Merge branch 'main' into feature/publishasdotnettool
darthsharp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains hidden or 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,35 @@ | ||
| name: integration | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'feature/**' | ||
|
|
||
| jobs: | ||
| macos-latest: | ||
| name: macos-latest | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Cache: ~/.nuget/packages' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.nuget/packages | ||
| key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} | ||
| - name: 'Build with target: NuGetPush, Publish, CreateDistPackages' | ||
| env: | ||
| NUGET_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: ./build.cmd -t nugetpush -t publish -t createdistpackages | ||
| - name: 'Publish: coverage_report' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report-macos | ||
| path: .tests/coverage-report | ||
| - name: 'Publish: cli dist package' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: MacSynkker.Cli | ||
| path: .artifacts/dist/MacSynkker.Cli.tar.gz |
This file contains hidden or 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,35 @@ | ||
| name: main | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| macos-latest: | ||
| name: macos-latest | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Cache: ~/.nuget/packages' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.nuget/packages | ||
| key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} | ||
| - name: 'Build with target: NuGetPush, Publish, CreateDistPackages, CreateGitHubRelease' | ||
| env: | ||
| NUGET_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: ./build.cmd -t nugetpush -t publish -t createdistpackages -t creategithubrelease | ||
| - name: 'Publish: coverage_report' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: .tests/coverage-report | ||
| - name: 'Publish: cli dist package' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: MacSynkker.Cli | ||
| path: .artifacts/dist/MacSynkker.Cli.tar.gz |
This file contains hidden or 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,28 @@ | ||
| name: pull-request | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| macos-latest: | ||
| name: macos-latest | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Cache: ~/.nuget/packages' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.nuget/packages | ||
| key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} | ||
| - name: 'Build with target: Pack' | ||
| run: ./build.cmd -t pack | ||
| - name: 'Publish: coverage_report' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: .tests/coverage-report |
This file contains hidden or 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,39 @@ | ||
| name: release | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v**' | ||
|
|
||
| jobs: | ||
| macos-latest: | ||
| name: macos-latest | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: 'Cache: ~/.nuget/packages' | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.nuget/packages | ||
| key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} | ||
| - name: 'Build with target: NuGetPush, Publish, CreateDistPackages, CreateGitHubRelease' | ||
| run: ./build.cmd -t nugetpush -t publish -t createdistpackages -t creategithubrelease | ||
| env: | ||
| NUGET_TOKEN: ${{ secrets.NUGET_ORG_TOKEN }} | ||
| - name: 'Publish: coverage_report' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: .tests/coverage-report | ||
| - name: 'Publish: cli dist package' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: MacSynkker.Cli | ||
| path: .artifacts/dist/MacSynkker.Cli.tar.gz |
This file contains hidden or 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,55 @@ | ||
| assembly-versioning-scheme: MajorMinorPatch | ||
| assembly-file-versioning-scheme: MajorMinorPatchTag | ||
| tag-prefix: '^v?' | ||
| semantic-version-format: Loose | ||
| major-version-bump-message: '\+semver:\s?(breaking|major)' | ||
| minor-version-bump-message: '\+semver:\s?(feature|minor)' | ||
| patch-version-bump-message: '\+semver:\s?(fix|patch)' | ||
| no-bump-message: '\+semver:\s?(none|skip)' | ||
| mode: ContinuousDeployment | ||
| branches: | ||
| feature: | ||
| mode: ContinuousDelivery | ||
| label: feature.{BranchName} | ||
| increment: Minor | ||
| track-merge-target: false | ||
| regex: ^features?[\/-](?<BranchName>.+) | ||
| prevent-increment: | ||
| when-current-commit-tagged: false | ||
| source-branches: | ||
| - main | ||
| tracks-release-branches: false | ||
| is-release-branch: false | ||
| is-main-branch: false | ||
| pre-release-weight: 30000 | ||
| main: | ||
| mode: ContinuousDelivery | ||
| label: 'ci' | ||
| increment: Patch | ||
| track-merge-target: false | ||
| regex: ^master$|^main$ | ||
| prevent-increment: | ||
| when-current-commit-tagged: true | ||
| source-branches: | ||
| - develop | ||
| - release | ||
| tracks-release-branches: false | ||
| is-release-branch: false | ||
| pre-release-weight: 55000 | ||
| pull-request: | ||
| mode: ContinuousDelivery | ||
| label: PR-{PullRequestName} | ||
| increment: Inherit | ||
| track-merge-target: false | ||
| regex: ^(pull|pull\-requests|pr)[/-](?<PullRequestName>.+) | ||
| prevent-increment: | ||
| when-current-commit-tagged: false | ||
| source-branches: | ||
| - main | ||
| - feature | ||
| tracks-release-branches: false | ||
| is-release-branch: false | ||
| pre-release-weight: 30000 | ||
| ignore: | ||
| sha: [ ] | ||
| merge-message-formats: { } |
This file contains hidden or 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,7 @@ | ||
| :; set -eo pipefail | ||
| :; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) | ||
| :; ${SCRIPT_DIR}/build.sh "$@" | ||
| :; exit $? | ||
|
|
||
| @ECHO OFF | ||
| powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* |
This file contains hidden or 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,45 @@ | ||
| [CmdletBinding()] | ||
| Param( | ||
| [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] | ||
| [string[]]$BuildArguments | ||
| ) | ||
|
|
||
| Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" | ||
|
|
||
| Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 } | ||
| $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
|
|
||
| ########################################################################### | ||
| # CONFIGURATION | ||
| ########################################################################### | ||
|
|
||
| $BuildProjectFile = "$PSScriptRoot\build\Build.csproj" | ||
| $DotNetGlobalFile = "$PSScriptRoot\\global.json" | ||
|
|
||
| $env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 | ||
| $env:DOTNET_NOLOGO = 1 | ||
|
|
||
| ########################################################################### | ||
| # EXECUTION | ||
| ########################################################################### | ||
|
|
||
| function ExecSafe([scriptblock] $cmd) { | ||
| & $cmd | ||
| if ($LASTEXITCODE) { exit $LASTEXITCODE } | ||
| } | ||
|
|
||
| # If dotnet CLI is installed globally and it matches requested version, use for execution | ||
| if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` | ||
| $(dotnet --version) -and $LASTEXITCODE -eq 0) { | ||
| $env:DOTNET_EXE = (Get-Command "dotnet").Path | ||
| } | ||
| else { | ||
| Write-Host "No matching dotnet version found" | ||
|
|
||
| exit 1 | ||
| } | ||
|
|
||
| Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)" | ||
|
|
||
| ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } | ||
| ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } | ||
This file contains hidden or 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,33 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| bash --version 2>&1 | head -n 1 | ||
|
|
||
| set -e | ||
| SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) | ||
|
|
||
| ########################################################################### | ||
| # CONFIGURATION | ||
| ########################################################################### | ||
|
|
||
| BUILD_PROJECT_FILE="$SCRIPT_DIR/build/Build.csproj" | ||
| DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json" | ||
|
|
||
|
darthsharp marked this conversation as resolved.
|
||
| export DOTNET_CLI_TELEMETRY_OPTOUT=1 | ||
| export DOTNET_NOLOGO=1 | ||
|
|
||
| ########################################################################### | ||
| # EXECUTION | ||
| ########################################################################### | ||
|
|
||
| # If dotnet CLI is installed globally and it matches requested version, use for execution | ||
| if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then | ||
| export DOTNET_EXE="$(command -v dotnet)" | ||
| else | ||
| echo "No matching dotnet version found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)" | ||
|
|
||
| "$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet | ||
| "$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" | ||
This file contains hidden or 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,14 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="CreativeCoders.CakeBuild" Version="6.6.0"/> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or 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,71 @@ | ||
| using Cake.Common.Build; | ||
| using Cake.Core; | ||
| using Cake.Core.IO; | ||
| using CreativeCoders.CakeBuild; | ||
| using CreativeCoders.CakeBuild.Tasks.Defaults; | ||
| using CreativeCoders.CakeBuild.Tasks.Templates.Settings; | ||
| using CreativeCoders.Core; | ||
| using CreativeCoders.Core.Collections; | ||
| using CreativeCoders.Core.IO; | ||
| using JetBrains.Annotations; | ||
|
|
||
| namespace Build; | ||
|
|
||
| [UsedImplicitly] | ||
| public class BuildContext(ICakeContext context) | ||
| : CakeBuildContext(context), IDefaultTaskSettings, ICreateDistPackagesTaskSettings, ICreateGitHubReleaseTaskSettings | ||
| { | ||
| public IList<DirectoryPath> DirectoriesToClean => this.CastAs<ICleanTaskSettings>() | ||
| .GetDefaultDirectoriesToClean().AddRange(RootDir.Combine(".tests")); | ||
|
|
||
|
|
||
| public string Copyright => $"{DateTime.Now.Year} CreativeCoders"; | ||
|
|
||
| public string PackageProjectUrl => "https://github.com/CreativeCodersTeam/macsynkker"; | ||
|
|
||
| public string PackageLicenseExpression => PackageLicenseExpressions.ApacheLicense20; | ||
|
|
||
| public string NuGetFeedUrl => this.GitHubActions().Environment.Workflow.Workflow == "release" | ||
| ? "nuget.org" | ||
| : "https://nuget.pkg.github.com/CreativeCodersTeam/index.json"; | ||
|
|
||
| public bool SkipPush => this.BuildSystem().IsPullRequest || | ||
| this.BuildSystem().IsLocalBuild; | ||
|
|
||
| public DirectoryPath PublishOutputDir => ArtifactsDir.Combine("published"); | ||
|
|
||
| private const string CliPath = "source/CreativeCoders.MacSynkker.Cli"; | ||
|
|
||
| private const string CliProjectFile = "CreativeCoders.MacSynkker.Cli.csproj"; | ||
|
|
||
| public IEnumerable<PublishingItem> PublishingItems => | ||
| [ | ||
| new PublishingItem( | ||
| RootDir | ||
| .Combine(CliPath) | ||
| .CombineWithFilePath(CliProjectFile), | ||
| PublishOutputDir.Combine("cli")) | ||
| ]; | ||
|
|
||
| private const string DistPackageName = "MacSynkker.Cli"; | ||
|
|
||
| public IEnumerable<DistPackage> DistPackages => | ||
| [ | ||
| new DistPackage(DistPackageName, PublishOutputDir.Combine("cli")) | ||
| ]; | ||
|
|
||
| public string ReleaseName => $"v{Version.FullSemVer}"; | ||
|
|
||
| public string ReleaseVersion => $"v{Version.FullSemVer}"; | ||
|
|
||
| public string ReleaseBody => "MacSynkker Release"; | ||
|
|
||
| public bool IsPreRelease => !string.IsNullOrWhiteSpace(Version.PreReleaseTag); | ||
|
|
||
| public IEnumerable<GitHubReleaseAsset> ReleaseAssets => | ||
| [ | ||
| new GitHubReleaseFileAsset( | ||
| GetRequiredSettings<ICreateDistPackagesTaskSettings>().DistOutputPath | ||
| .CombineWithFilePath(DistPackageName + ".tar.gz").FullPath, null) | ||
| ]; | ||
| } |
This file contains hidden or 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,19 @@ | ||
| using CreativeCoders.CakeBuild; | ||
|
|
||
| namespace Build; | ||
|
|
||
| internal static class Program | ||
| { | ||
| internal static int Main(string[] args) | ||
| { | ||
| return CakeHostBuilder.Create() | ||
| .UseBuildContext<BuildContext>() | ||
| .AddDefaultTasks() | ||
| .AddBuildServerIntegration() | ||
| .InstallTools( | ||
| new DotNetToolInstallation("GitVersion.Tool", "6.5.1"), | ||
| new DotNetToolInstallation("dotnet-reportgenerator-globaltool", "5.5.1")) | ||
| .Build() | ||
| .Run(args); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.