Skip to content

Commit

Permalink
Merge branch 'release/0.18.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
devlead committed Mar 27, 2022
2 parents 43291ff + 12c81e2 commit ea5536a
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 156 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.1.0",
"commands": [
"dotnet-cake"
]
}
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: devlead
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build
on:
pull_request:
push:
branches:
- main
- develop
- hotfix/*

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-latest, macos-latest]
steps:
- name: Get the sources
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install .NET Core SDK
uses: actions/setup-dotnet@v1

- name: Run Cake script
uses: cake-build/cake-action@v1
env:
GH_PACKAGES_NUGET_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
GH_PACKAGES_NUGET_APIKEY: ${{ secrets.GITHUB_TOKEN }}
NUGET_SOURCE: ${{ secrets.NUGET_API_URL }}
NUGET_APIKEY: ${{ secrets.NUGET_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
cake-version: tool-manifest
target: GitHub-Actions
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Notation) strings.
| Bitrise | MacOS | [![Build Status](https://app.bitrise.io/app/5975a00ca2666fb1/status.svg?token=OZnv4YWRw71IVax38Wi50Q&branch=develop)](https://app.bitrise.io/app/5975a00ca2666fb1) |
| Bitrise | Linux | [![Build Status](https://app.bitrise.io/app/4c9ee62c6ba13630/status.svg?token=RBH8UKw-68lQYjageT8VoQ&branch=develop)](https://app.bitrise.io/app/4c9ee62c6ba13630)|
| Travis | Linux / MacOS | [![Travis build status](https://travis-ci.org/LitJSON/litjson.svg?branch=develop)](https://travis-ci.org/LitJSON/litjson) |

| Azure Pipelines | Linux / MacOS / Windows | [![Azure Pipelines Build Status](https://dev.azure.com/LitJSON/litjson/_apis/build/status/LitJSON.litjson?branchName=develop)](https://dev.azure.com/LitJSON/litjson/_build/latest?definitionId=3&branchName=develop) |

## Compiling

Expand Down
31 changes: 31 additions & 0 deletions azure-pipelines.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
strategy:
matrix:
linux:
imageName: 'ubuntu-20.04'
mac:
imageName: 'macos-10.15'
windows:
imageName: 'windows-2019'

pool:
vmImage: $(imageName)

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true

- task: Bash@3
displayName: 'Bash Script'
condition: ne( variables['Agent.OS'], 'Windows_NT' )
inputs:
targetType: filePath
filePath: ./build.sh

- task: PowerShell@2
displayName: 'PowerShell Script'
condition: eq( variables['Agent.OS'], 'Windows_NT' )
inputs:
targetType: filePath
filePath: ./build.ps1
81 changes: 57 additions & 24 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// Install modules
#module nuget:?package=Cake.DotNetTool.Module&version=0.3.0

// Install tools
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0

// Install .NET Core Global tools.
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.0.1"
#tool "dotnet:?package=GitVersion.Tool&version=5.9.0"

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand All @@ -18,7 +15,7 @@ var configuration = Argument("configuration", "Release");
// PARAMETERS
//////////////////////////////////////////////////////////////////////

DotNetCoreMSBuildSettings msBuildSettings = null;
DotNetMSBuildSettings msBuildSettings = null;
string version = null,
semVersion = null,
milestone = null;
Expand Down Expand Up @@ -54,10 +51,12 @@ Setup(ctx =>
Information("Calculated Semantic Version: {0}", semVersion);
msBuildSettings = new DotNetCoreMSBuildSettings()
msBuildSettings = new DotNetMSBuildSettings()
.WithProperty("Version", semVersion)
.WithProperty("AssemblyVersion", version)
.WithProperty("FileVersion", version);
.WithProperty("FileVersion", version)
.WithProperty("ContinuousIntegrationBuild", BuildSystem.IsLocalBuild ? bool.FalseString : bool.TrueString);
if(!IsRunningOnWindows())
{
Expand Down Expand Up @@ -107,16 +106,16 @@ Task("Clean")
Task("Restore")
.IsDependentOn("Clean")
.Does(() => {
DotNetCoreRestore("./LitJSON.sln",
new DotNetCoreRestoreSettings { MSBuildSettings = msBuildSettings }
DotNetRestore("./LitJSON.sln",
new DotNetRestoreSettings { MSBuildSettings = msBuildSettings }
);
});

Task("Build")
.IsDependentOn("Restore")
.Does(() => {
DotNetCoreBuild("./LitJSON.sln",
new DotNetCoreBuildSettings {
DotNetBuild("./LitJSON.sln",
new DotNetBuildSettings {
Configuration = configuration,
MSBuildSettings = msBuildSettings,
ArgumentCustomization = args => args.Append("--no-restore")
Expand All @@ -127,10 +126,10 @@ Task("Build")
Task("Test")
.IsDependentOn("Build")
.Does(() => {
DotNetCoreTest("./test/LitJSON.Tests.csproj",
new DotNetCoreTestSettings {
DotNetTest("./test/LitJSON.Tests.csproj",
new DotNetTestSettings {
Configuration = configuration,
Framework = "netcoreapp2.0",
Framework = "net6.0",
NoBuild = true,
ArgumentCustomization = args => args.Append("--no-restore")
}
Expand All @@ -143,20 +142,20 @@ Task("Test")

Task("Test-SourceLink")
.IsDependentOn("Build")
.WithCriteria(IsRunningOnWindows())
.WithCriteria(IsRunningOnWindows() && AppVeyor.IsRunningOnAppVeyor)
.Does(() => {
foreach(var asssembly in GetFiles("./src/LitJson/bin/" + configuration + "/**/*.dll"))
{
DotNetCoreTool(litjsonProjectPath.FullPath, "sourcelink", $"test {asssembly}");
DotNetTool(litjsonProjectPath.FullPath, "sourcelink", $"test {asssembly}");
}
});

Task("Package")
.IsDependentOn("Test")
.IsDependentOn("Test-SourceLink")
.Does(() => {
DotNetCorePack(litjsonProjectPath.FullPath,
new DotNetCorePackSettings {
DotNetPack(litjsonProjectPath.FullPath,
new DotNetPackSettings {
Configuration = configuration,
NoBuild = true,
IncludeSymbols = true,
Expand Down Expand Up @@ -197,8 +196,8 @@ Task("Publish-MyGet")
foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg")))
{
DotNetCoreNuGetPush(package.FullPath,
new DotNetCoreNuGetPushSettings {
DotNetNuGetPush(package.FullPath,
new DotNetNuGetPushSettings {
ApiKey = apiKey,
Source = apiUrl
}
Expand All @@ -215,19 +214,50 @@ Task("Publish-NuGet")
// Resolve the API key.
var apiKey = EnvironmentVariable("NUGET_API_KEY");
if(string.IsNullOrEmpty(apiKey)) {
throw new InvalidOperationException("Could not resolve MyGet API key.");
throw new InvalidOperationException("Could not resolve NuGet API key.");
}
// Resolve the API url.
var apiUrl = EnvironmentVariable("NUGET_API_URL");
if(string.IsNullOrEmpty(apiUrl)) {
throw new InvalidOperationException("Could not resolve MyGet API url.");
throw new InvalidOperationException("Could not resolve NuGet API url.");
}
foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg")))
{
DotNetNuGetPush(package.FullPath,
new DotNetNuGetPushSettings {
ApiKey = apiKey,
Source = apiUrl
}
);
}
});

Task("Push-GitHub-Packages")
.IsDependentOn("Package")
.WithCriteria(
GitHubActions.IsRunningOnGitHubActions &&
!GitHubActions.Environment.PullRequest.IsPullRequest &&
IsRunningOnWindows())
.Does(() => {
// Resolve the API key.
var apiKey = EnvironmentVariable("GH_PACKAGES_NUGET_APIKEY");
if(string.IsNullOrEmpty(apiKey)) {
throw new InvalidOperationException("Could not resolve GitHub API key.");
}
// Resolve the API url.
var apiUrl = EnvironmentVariable("GH_PACKAGES_NUGET_SOURCE");
if(string.IsNullOrEmpty(apiUrl)) {
throw new InvalidOperationException("Could not resolve GitHub API url.");
}
foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg")))
{
DotNetCoreNuGetPush(package.FullPath,
new DotNetCoreNuGetPushSettings {
DotNetNuGetPush(package.FullPath,
new DotNetNuGetPushSettings {
ApiKey = apiKey,
Source = apiUrl
}
Expand All @@ -240,6 +270,9 @@ Task("AppVeyor")
.IsDependentOn("Publish-MyGet")
.IsDependentOn("Publish-NuGet");

Task("GitHub-Actions")
.IsDependentOn("Push-GitHub-Packages");

Task("Default")
.IsDependentOn("Package");

Expand Down
3 changes: 0 additions & 3 deletions build.config

This file was deleted.

Loading

0 comments on commit ea5536a

Please sign in to comment.