Skip to content

Commit db8a393

Browse files
committed
upgrade to .net 6, move to project-based build pipeline
1 parent 6fec834 commit db8a393

File tree

90 files changed

+639
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+639
-135
lines changed

Diff for: .config/dotnet-tools.json

+5-17
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,17 @@
22
"version": 1,
33
"isRoot": true,
44
"tools": {
5-
"fake-cli": {
6-
"version": "5.20.4",
7-
"commands": [
8-
"fake"
9-
]
10-
},
11-
"paket": {
12-
"version": "5.257.0",
5+
"fantomas-tool": {
6+
"version": "4.7.5",
137
"commands": [
14-
"paket"
8+
"fantomas"
159
]
1610
},
17-
"fsharp.formatting.commandtool": {
18-
"version": "11.5.1",
11+
"fsdocs-tool": {
12+
"version": "15.0.0",
1913
"commands": [
2014
"fsdocs"
2115
]
22-
},
23-
"fantomas-tool": {
24-
"version": "4.5.8",
25-
"commands": [
26-
"fantomas"
27-
]
2816
}
2917
}
3018
}

Diff for: .github/workflows/build-and-test.yml

+11-18
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,34 @@ on:
66
pull_request:
77
branches: [ dev ]
88

9+
910
jobs:
1011
build-and-test-linux:
1112

1213
runs-on: ubuntu-latest
1314

1415
steps:
1516
- uses: actions/checkout@v2
16-
- name: Setup .NET 3.1
17-
uses: actions/setup-dotnet@v1
18-
with:
19-
dotnet-version: '3.1.x'
20-
- name: Setup .NET 5
17+
- name: Setup .NET
2118
uses: actions/setup-dotnet@v1
2219
with:
23-
dotnet-version: '5.0.201'
24-
- name: Restore local tools
25-
run: dotnet tool restore
20+
dotnet-version: 6.x.x
21+
- name: make script executable
22+
run: chmod u+x build.sh
2623
- name: Build and test
27-
run: dotnet fake build -t runTests
24+
working-directory: ./
25+
run: ./build.sh runtests
2826

2927
build-and-test-windows:
3028

3129
runs-on: windows-latest
3230

3331
steps:
3432
- uses: actions/checkout@v2
35-
- name: Setup .NET 3.1
36-
uses: actions/setup-dotnet@v1
37-
with:
38-
dotnet-version: '3.1.x'
39-
- name: Setup .NET 5
33+
- name: Setup .NET
4034
uses: actions/setup-dotnet@v1
4135
with:
42-
dotnet-version: '5.0.201'
43-
- name: Restore local tools
44-
run: dotnet tool restore
36+
dotnet-version: 6.x.x
4537
- name: Build and test
46-
run: dotnet fake build -t runTests
38+
working-directory: ./
39+
run: ./build.cmd runtests

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
[Dd]ebug/
1717
[Rr]elease/
1818
x64/
19-
build/
2019
[Bb]in/
2120
[Oo]bj/
2221

Diff for: Plotly.NET.sln

+10-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "git", "git", "{078A9C52-DDC
1919
.gitignore = .gitignore
2020
EndProjectSection
2121
EndProject
22-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{7C6D08E7-3EAC-4335-8F4B-252C193C27C9}"
22+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7C6D08E7-3EAC-4335-8F4B-252C193C27C9}"
2323
ProjectSection(SolutionItems) = preProject
2424
build.cmd = build.cmd
25-
build.fsx = build.fsx
2625
build.sh = build.sh
2726
EndProjectSection
2827
EndProject
@@ -149,6 +148,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plotly.NET.Tests.CSharp", "
149148
EndProject
150149
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Plotly.NET.ImageExport.Tests", "tests\Plotly.NET.ImageExport.Tests\Plotly.NET.ImageExport.Tests.fsproj", "{55A461C3-8018-4020-B16E-D6005BDFCAED}"
151150
EndProject
151+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "build", "build\build.fsproj", "{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}"
152+
EndProject
152153
Global
153154
GlobalSection(SolutionConfigurationPlatforms) = preSolution
154155
Debug|Any CPU = Debug|Any CPU
@@ -204,6 +205,12 @@ Global
204205
{55A461C3-8018-4020-B16E-D6005BDFCAED}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
205206
{55A461C3-8018-4020-B16E-D6005BDFCAED}.Release|Any CPU.ActiveCfg = Release|Any CPU
206207
{55A461C3-8018-4020-B16E-D6005BDFCAED}.Release|Any CPU.Build.0 = Release|Any CPU
208+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
209+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
210+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
211+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
212+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
213+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD}.Release|Any CPU.Build.0 = Release|Any CPU
207214
EndGlobalSection
208215
GlobalSection(SolutionProperties) = preSolution
209216
HideSolutionNode = FALSE
@@ -220,6 +227,7 @@ Global
220227
{1BC73DA0-586F-45C2-BC5B-A70C452A00F0} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
221228
{26539796-0C9D-4856-8584-B58BE32CC495} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
222229
{55A461C3-8018-4020-B16E-D6005BDFCAED} = {EAE25A1F-86FC-426B-803F-1006D1AD06A8}
230+
{403785C9-B5B1-4BA4-9944-A0F9D5D1B3CD} = {7C6D08E7-3EAC-4335-8F4B-252C193C27C9}
223231
EndGlobalSection
224232
GlobalSection(ExtensibilityGlobals) = postSolution
225233
SolutionGuid = {7177F1E1-341C-48AB-9864-6B525FFF7633}

Diff for: README.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Plotly.NET provides functions for generating and rendering plotly.js charts in *
2626
- [docs](#docs)
2727
- [Library license](#library-license)
2828

29-
30-
3129
# Installation
3230

3331
Plotly.NET will be available as 2.0.0 version of its predecessor FSharp.Plotly. The feature roadmap can be seen [here](https://github.com/plotly/Plotly.NET/issues/43). Contributions are very welcome!
@@ -98,31 +96,31 @@ _Note:_ The `release` and `prerelease` build targets assume that there is a `NUG
9896

9997
### build
10098

101-
Check the [build.fsx file](https://github.com/plotly/Plotly.NET/blob/dev/build.fsx) to take a look at the build targets. Here are some examples:
99+
Check the [build project](https://github.com/plotly/Plotly.NET/blob/dev/build) to take a look at the build targets. Here are some examples:
102100

103101
```shell
104102
# Windows
105103

106104
# Build only
107105
./build.cmd
108106

109-
# Full release buildchain: build, test, pack, build the docs, push a git tag, publsih thze nuget package, release the docs
110-
./build.cmd -t release
107+
# Full release buildchain: build, test, pack, build the docs, push a git tag, publish thze nuget package, release the docs
108+
./build.cmd release
111109

112110
# The same for prerelease versions:
113-
./build.cmd -t prerelease
111+
./build.cmd prerelease
114112

115113

116114
# Linux/mac
117115

118116
# Build only
119117
build.sh
120118

121-
# Full release buildchain: build, test, pack, build the docs, push a git tag, publsih thze nuget package, release the docs
122-
build.sh -t release
119+
# Full release buildchain: build, test, pack, build the docs, push a git tag, publísh the nuget package, release the docs
120+
build.sh release
123121

124122
# The same for prerelease versions:
125-
build.sh -t prerelease
123+
build.sh prerelease
126124

127125
```
128126

@@ -132,15 +130,12 @@ The docs are contained in `.fsx` and `.md` files in the `docs` folder. To develo
132130

133131
```shell
134132
# Windows
135-
./build.cmd -t watchdocs
133+
./build.cmd watchdocs
136134

137135
# Linux/mac
138-
./build.sh -t watchdocs
136+
./build.sh watchdocs
139137
```
140138

141-
142-
### release
143-
144139
Library license
145140
===============
146141

Diff for: build.cmd

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
@echo off
22
cls
33

4-
dotnet tool restore
5-
dotnet restore
6-
dotnet fake build %*
4+
dotnet run --project ./build/build.fsproj %*

Diff for: build.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/usr/bin/env bash
2-
# to properly set Travis permissions: https://stackoverflow.com/questions/33820638/travis-yml-gradlew-permission-denied
3-
# git update-index --chmod=+x fake.sh
4-
# git commit -m "permission access for travis"
52

63
set -eu
74
set -o pipefail
85

9-
dotnet tool restore
10-
dotnet restore
11-
dotnet fake build "$@"
6+
dotnet run --project ./build/build.fsproj "$@"

Diff for: build/BasicTasks.fs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module BasicTasks
2+
3+
open BlackFox.Fake
4+
open Fake.IO
5+
open Fake.DotNet
6+
open Fake.IO.Globbing.Operators
7+
8+
open ProjectInfo
9+
10+
let setPrereleaseTag = BuildTask.create "SetPrereleaseTag" [] {
11+
printfn "Please enter pre-release package suffix"
12+
let suffix = System.Console.ReadLine()
13+
prereleaseSuffix <- suffix
14+
prereleaseTag <- (sprintf "%s-%s" release.NugetVersion suffix)
15+
isPrerelease <- true
16+
}
17+
18+
let clean = BuildTask.create "Clean" [] {
19+
!! "src/**/bin"
20+
++ "src/**/obj"
21+
++ "tests/**/bin"
22+
++ "tests/**/obj"
23+
++ "pkg"
24+
|> Shell.cleanDirs
25+
}
26+
27+
let build = BuildTask.create "Build" [clean] {
28+
solutionFile
29+
|> DotNet.build id
30+
}

Diff for: build/Build.fs

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
open BlackFox.Fake
2+
open System.IO
3+
open Fake.Core
4+
open Fake.DotNet
5+
open Fake.IO
6+
open Fake.IO.FileSystemOperators
7+
open Fake.IO.Globbing.Operators
8+
open Fake.Tools
9+
10+
open Helpers
11+
12+
initializeContext()
13+
14+
open BasicTasks
15+
open TestTasks
16+
open PackageTasks
17+
open DocumentationTasks
18+
open ReleaseTasks
19+
20+
/// Full release of nuget package, git tag, and documentation for the stable version.
21+
let _release =
22+
BuildTask.createEmpty
23+
"Release"
24+
[clean; build; runTests; pack; buildDocs; createTag; publishNuget; releaseDocs]
25+
26+
/// Full release of nuget package, git tag, and documentation for the prerelease version.
27+
let _preRelease =
28+
BuildTask.createEmpty
29+
"PreRelease"
30+
[setPrereleaseTag; clean; build; runTests; packPrerelease; buildDocsPrerelease; createPrereleaseTag; publishNugetPrerelease; prereleaseDocs]
31+
32+
/// Full release of nuget package for the prerelease version.
33+
let _releaseNoDocs =
34+
BuildTask.createEmpty
35+
"ReleaseNoDocs"
36+
[clean; build; runTests; pack; createTag; publishNuget;]
37+
38+
/// Full release of nuget package for the prerelease version.
39+
let _preReleaseNoDocs =
40+
BuildTask.createEmpty
41+
"PreReleaseNoDocs"
42+
[setPrereleaseTag; clean; build; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease]
43+
44+
[<EntryPoint>]
45+
let main args =
46+
runOrDefault build args

Diff for: build/DocumentationTasks.fs

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module DocumentationTasks
2+
3+
open Helpers
4+
open ProjectInfo
5+
open BasicTasks
6+
7+
open BlackFox.Fake
8+
9+
let buildDocs = BuildTask.create "BuildDocs" [build] {
10+
printfn "building docs with stable version %s" stableVersionTag
11+
runDotNet
12+
(sprintf "fsdocs build --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" stableVersionTag)
13+
"./"
14+
}
15+
16+
let buildDocsPrerelease = BuildTask.create "BuildDocsPrerelease" [setPrereleaseTag; build] {
17+
printfn "building docs with prerelease version %s" prereleaseTag
18+
runDotNet
19+
(sprintf "fsdocs build --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" prereleaseTag)
20+
"./"
21+
}
22+
23+
let watchDocs = BuildTask.create "WatchDocs" [build] {
24+
printfn "watching docs with stable version %s" stableVersionTag
25+
runDotNet
26+
(sprintf "fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" stableVersionTag)
27+
"./"
28+
}
29+
30+
let watchDocsPrerelease = BuildTask.create "WatchDocsPrerelease" [setPrereleaseTag; build] {
31+
printfn "watching docs with prerelease version %s" prereleaseTag
32+
runDotNet
33+
(sprintf "fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" prereleaseTag)
34+
"./"
35+
}

Diff for: build/FormattingTasks.fs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module FormattingTasks
2+
3+
open MessagePrompts
4+
open ProjectInfo
5+
open BasicTasks
6+
7+
open BlackFox.Fake
8+
open Fake.Core
9+
open Fake.DotNet
10+
open Fake.Api
11+
open Fake.Tools
12+
open Fake.IO
13+
open Fake.IO.Globbing.Operators
14+
15+
// files that will be formatted by fantomas
16+
let sourceFiles =
17+
!! "src/Plotly.NET/**/*.fs"
18+
++ "src/Plotly.NET.ImageExport/**/*.fs"
19+
++ "src/Plotly.NET.Interactive/**/*.fs"
20+
-- "**/obj/**/*.*"
21+
-- "**/bin/**/*.*"
22+
23+
let ccheckFormat =
24+
BuildTask.create "CheckFormat" [] {
25+
let result =
26+
sourceFiles
27+
|> Seq.map (sprintf "\"%s\"")
28+
|> String.concat " "
29+
|> sprintf "%s --check"
30+
|> DotNet.exec id "fantomas"
31+
32+
if result.ExitCode = 0 then
33+
Trace.log "No files need formatting"
34+
elif result.ExitCode = 99 then
35+
failwith "Some files need formatting, check output for more info"
36+
else
37+
Trace.logf "Errors while formatting: %A" result.Errors
38+
}
39+
40+
let format =
41+
BuildTask.create "Format" [] {
42+
let result =
43+
sourceFiles
44+
|> Seq.map (sprintf "\"%s\"")
45+
|> String.concat " "
46+
|> DotNet.exec id "fantomas"
47+
48+
if not result.OK then
49+
printfn "Errors while formatting all files: %A" result.Messages
50+
}

0 commit comments

Comments
 (0)