Skip to content

Commit ea5536a

Browse files
committed
Merge branch 'release/0.18.0'
2 parents 43291ff + 12c81e2 commit ea5536a

12 files changed

Lines changed: 177 additions & 156 deletions

File tree

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"cake.tool": {
6+
"version": "2.1.0",
7+
"commands": [
8+
"dotnet-cake"
9+
]
10+
}
11+
}
12+
}

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: devlead

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
- hotfix/*
9+
10+
jobs:
11+
build:
12+
name: Build
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [windows-2019, ubuntu-latest, macos-latest]
18+
steps:
19+
- name: Get the sources
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Install .NET Core SDK
25+
uses: actions/setup-dotnet@v1
26+
27+
- name: Run Cake script
28+
uses: cake-build/cake-action@v1
29+
env:
30+
GH_PACKAGES_NUGET_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
31+
GH_PACKAGES_NUGET_APIKEY: ${{ secrets.GITHUB_TOKEN }}
32+
NUGET_SOURCE: ${{ secrets.NUGET_API_URL }}
33+
NUGET_APIKEY: ${{ secrets.NUGET_API_KEY }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
cake-version: tool-manifest
37+
target: GitHub-Actions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Notation) strings.
1919
| Bitrise | MacOS | [![Build Status](https://app.bitrise.io/app/5975a00ca2666fb1/status.svg?token=OZnv4YWRw71IVax38Wi50Q&branch=develop)](https://app.bitrise.io/app/5975a00ca2666fb1) |
2020
| Bitrise | Linux | [![Build Status](https://app.bitrise.io/app/4c9ee62c6ba13630/status.svg?token=RBH8UKw-68lQYjageT8VoQ&branch=develop)](https://app.bitrise.io/app/4c9ee62c6ba13630)|
2121
| Travis | Linux / MacOS | [![Travis build status](https://travis-ci.org/LitJSON/litjson.svg?branch=develop)](https://travis-ci.org/LitJSON/litjson) |
22-
22+
| 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) |
2323

2424
## Compiling
2525

azure-pipelines.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
strategy:
2+
matrix:
3+
linux:
4+
imageName: 'ubuntu-20.04'
5+
mac:
6+
imageName: 'macos-10.15'
7+
windows:
8+
imageName: 'windows-2019'
9+
10+
pool:
11+
vmImage: $(imageName)
12+
13+
steps:
14+
- task: UseDotNet@2
15+
displayName: 'Use .NET Core sdk'
16+
inputs:
17+
useGlobalJson: true
18+
19+
- task: Bash@3
20+
displayName: 'Bash Script'
21+
condition: ne( variables['Agent.OS'], 'Windows_NT' )
22+
inputs:
23+
targetType: filePath
24+
filePath: ./build.sh
25+
26+
- task: PowerShell@2
27+
displayName: 'PowerShell Script'
28+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
29+
inputs:
30+
targetType: filePath
31+
filePath: ./build.ps1

build.cake

Lines changed: 57 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
// Install modules
2-
#module nuget:?package=Cake.DotNetTool.Module&version=0.3.0
3-
41
// Install tools
52
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
63

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

107
///////////////////////////////////////////////////////////////////////////////
118
// ARGUMENTS
@@ -18,7 +15,7 @@ var configuration = Argument("configuration", "Release");
1815
// PARAMETERS
1916
//////////////////////////////////////////////////////////////////////
2017

21-
DotNetCoreMSBuildSettings msBuildSettings = null;
18+
DotNetMSBuildSettings msBuildSettings = null;
2219
string version = null,
2320
semVersion = null,
2421
milestone = null;
@@ -54,10 +51,12 @@ Setup(ctx =>
5451

5552
Information("Calculated Semantic Version: {0}", semVersion);
5653

57-
msBuildSettings = new DotNetCoreMSBuildSettings()
54+
msBuildSettings = new DotNetMSBuildSettings()
5855
.WithProperty("Version", semVersion)
5956
.WithProperty("AssemblyVersion", version)
60-
.WithProperty("FileVersion", version);
57+
.WithProperty("FileVersion", version)
58+
.WithProperty("ContinuousIntegrationBuild", BuildSystem.IsLocalBuild ? bool.FalseString : bool.TrueString);
59+
6160

6261
if(!IsRunningOnWindows())
6362
{
@@ -107,16 +106,16 @@ Task("Clean")
107106
Task("Restore")
108107
.IsDependentOn("Clean")
109108
.Does(() => {
110-
DotNetCoreRestore("./LitJSON.sln",
111-
new DotNetCoreRestoreSettings { MSBuildSettings = msBuildSettings }
109+
DotNetRestore("./LitJSON.sln",
110+
new DotNetRestoreSettings { MSBuildSettings = msBuildSettings }
112111
);
113112
});
114113

115114
Task("Build")
116115
.IsDependentOn("Restore")
117116
.Does(() => {
118-
DotNetCoreBuild("./LitJSON.sln",
119-
new DotNetCoreBuildSettings {
117+
DotNetBuild("./LitJSON.sln",
118+
new DotNetBuildSettings {
120119
Configuration = configuration,
121120
MSBuildSettings = msBuildSettings,
122121
ArgumentCustomization = args => args.Append("--no-restore")
@@ -127,10 +126,10 @@ Task("Build")
127126
Task("Test")
128127
.IsDependentOn("Build")
129128
.Does(() => {
130-
DotNetCoreTest("./test/LitJSON.Tests.csproj",
131-
new DotNetCoreTestSettings {
129+
DotNetTest("./test/LitJSON.Tests.csproj",
130+
new DotNetTestSettings {
132131
Configuration = configuration,
133-
Framework = "netcoreapp2.0",
132+
Framework = "net6.0",
134133
NoBuild = true,
135134
ArgumentCustomization = args => args.Append("--no-restore")
136135
}
@@ -143,20 +142,20 @@ Task("Test")
143142

144143
Task("Test-SourceLink")
145144
.IsDependentOn("Build")
146-
.WithCriteria(IsRunningOnWindows())
145+
.WithCriteria(IsRunningOnWindows() && AppVeyor.IsRunningOnAppVeyor)
147146
.Does(() => {
148147
foreach(var asssembly in GetFiles("./src/LitJson/bin/" + configuration + "/**/*.dll"))
149148
{
150-
DotNetCoreTool(litjsonProjectPath.FullPath, "sourcelink", $"test {asssembly}");
149+
DotNetTool(litjsonProjectPath.FullPath, "sourcelink", $"test {asssembly}");
151150
}
152151
});
153152

154153
Task("Package")
155154
.IsDependentOn("Test")
156155
.IsDependentOn("Test-SourceLink")
157156
.Does(() => {
158-
DotNetCorePack(litjsonProjectPath.FullPath,
159-
new DotNetCorePackSettings {
157+
DotNetPack(litjsonProjectPath.FullPath,
158+
new DotNetPackSettings {
160159
Configuration = configuration,
161160
NoBuild = true,
162161
IncludeSymbols = true,
@@ -197,8 +196,8 @@ Task("Publish-MyGet")
197196

198197
foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg")))
199198
{
200-
DotNetCoreNuGetPush(package.FullPath,
201-
new DotNetCoreNuGetPushSettings {
199+
DotNetNuGetPush(package.FullPath,
200+
new DotNetNuGetPushSettings {
202201
ApiKey = apiKey,
203202
Source = apiUrl
204203
}
@@ -215,19 +214,50 @@ Task("Publish-NuGet")
215214
// Resolve the API key.
216215
var apiKey = EnvironmentVariable("NUGET_API_KEY");
217216
if(string.IsNullOrEmpty(apiKey)) {
218-
throw new InvalidOperationException("Could not resolve MyGet API key.");
217+
throw new InvalidOperationException("Could not resolve NuGet API key.");
219218
}
220219

221220
// Resolve the API url.
222221
var apiUrl = EnvironmentVariable("NUGET_API_URL");
223222
if(string.IsNullOrEmpty(apiUrl)) {
224-
throw new InvalidOperationException("Could not resolve MyGet API url.");
223+
throw new InvalidOperationException("Could not resolve NuGet API url.");
224+
}
225+
226+
foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg")))
227+
{
228+
DotNetNuGetPush(package.FullPath,
229+
new DotNetNuGetPushSettings {
230+
ApiKey = apiKey,
231+
Source = apiUrl
232+
}
233+
);
234+
}
235+
});
236+
237+
Task("Push-GitHub-Packages")
238+
.IsDependentOn("Package")
239+
.WithCriteria(
240+
GitHubActions.IsRunningOnGitHubActions &&
241+
!GitHubActions.Environment.PullRequest.IsPullRequest &&
242+
IsRunningOnWindows())
243+
.Does(() => {
244+
245+
// Resolve the API key.
246+
var apiKey = EnvironmentVariable("GH_PACKAGES_NUGET_APIKEY");
247+
if(string.IsNullOrEmpty(apiKey)) {
248+
throw new InvalidOperationException("Could not resolve GitHub API key.");
249+
}
250+
251+
// Resolve the API url.
252+
var apiUrl = EnvironmentVariable("GH_PACKAGES_NUGET_SOURCE");
253+
if(string.IsNullOrEmpty(apiUrl)) {
254+
throw new InvalidOperationException("Could not resolve GitHub API url.");
225255
}
226256

227257
foreach(var package in (GetFiles("./artifacts/nuget/*.nupkg") - GetFiles("./artifacts/nuget/*.symbols.nupkg")))
228258
{
229-
DotNetCoreNuGetPush(package.FullPath,
230-
new DotNetCoreNuGetPushSettings {
259+
DotNetNuGetPush(package.FullPath,
260+
new DotNetNuGetPushSettings {
231261
ApiKey = apiKey,
232262
Source = apiUrl
233263
}
@@ -240,6 +270,9 @@ Task("AppVeyor")
240270
.IsDependentOn("Publish-MyGet")
241271
.IsDependentOn("Publish-NuGet");
242272

273+
Task("GitHub-Actions")
274+
.IsDependentOn("Push-GitHub-Packages");
275+
243276
Task("Default")
244277
.IsDependentOn("Package");
245278

build.config

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)