Skip to content

Commit 026f144

Browse files
committed
start builds
1 parent 91a39a4 commit 026f144

File tree

8 files changed

+130
-51
lines changed

8 files changed

+130
-51
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
strategy:
9+
matrix:
10+
os: [windows-latest, macos-latest, ubuntu-latest]
11+
dotnet: [3.1.201] # TODO: wish this action didn't pin versions...
12+
runs-on: ${{ matrix.os }}
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Setup .Net Core
17+
uses: actions/setup-dotnet
18+
with:
19+
dotnet-version: ${{matrix.dotnet}}
20+
- name: Restore tools
21+
run: dotnet tool restore
22+
- name: Build and test
23+
run: dotnet fake build -t TestAndNuGet
24+
- name: Archive code coverage results
25+
uses: actions/upload-artifact@v2
26+
with:
27+
name: code-coverage-report
28+
path: ${{ github.workspace }}/artifacts/TestResults/Release/FSharp.Compiler.Service.Test.*.xml

.github/workflows/docs.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release docs
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: macos-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Setup .NET Core
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 3.1.201
19+
- name: Restore tools
20+
run: dotnet tool restore
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
- name: Run Fornax
24+
run: dotnet fake build -t GenerateDocs
25+
- name: Deploy
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
personal_token: ${{ secrets.GITHUB_TOKEN }}
29+
publish_dir: ./docsrc/_public
30+
publish_branch: gh-pages
31+
force_orphan: true

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
11+
strategy:
12+
matrix:
13+
os: [macos-latest]
14+
dotnet: [3.1.201]
15+
runs-on: ${{ matrix.os }}
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Setup .NET Core
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: ${{ matrix.dotnet }}
23+
- name: Restore tools
24+
run: dotnet tool restore
25+
- name: Build and Test
26+
run: dotnet fake build -t TestAndNuget
27+
- name: Validate package bump
28+
run: dotnet fake build -s -t ValidateVersionBump
29+
- name: Publish to nuget
30+
run: dotnet fake build -s -t PublishNuget
31+
env:
32+
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
33+
- name: Create release
34+
run: dotnet fake build -s -t CreateRelease
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+

.travis.yml

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

appveyor.yml

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

fcs/build.fsx

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ open Fake.BuildServer
1111
open Fake.Core
1212
open Fake.DotNet
1313
open Fake.IO
14+
open Fake.Api
15+
open Fake.Tools
1416

1517
BuildServer.install [ AppVeyor.Installer ]
1618
// --------------------------------------------------------------------------------------
@@ -41,15 +43,8 @@ let docsDir = Path.Combine(__SOURCE_DIRECTORY__, "docsrc", "_public")
4143

4244
// Read release notes & version info from RELEASE_NOTES.md
4345
let release = ReleaseNotes.load (__SOURCE_DIRECTORY__ + "/RELEASE_NOTES.md")
44-
let isAppVeyorBuild = AppVeyor.detect()
4546
let isVersionTag (tag: string) = Version.TryParse tag |> fst
46-
let hasRepoVersionTag = isAppVeyorBuild && AppVeyor.Environment.RepoTag && isVersionTag AppVeyor.Environment.RepoTagName
47-
let assemblyVersion = if hasRepoVersionTag then AppVeyor.Environment.RepoTagName else release.NugetVersion
48-
49-
let buildVersion =
50-
if hasRepoVersionTag then assemblyVersion
51-
else if isAppVeyorBuild then sprintf "%s-b%s" assemblyVersion AppVeyor.Environment.BuildNumber
52-
else assemblyVersion
47+
let assemblyVersion = release.NugetVersion
5348

5449
Target.create "Clean" (fun _ ->
5550
Shell.cleanDir releaseDir
@@ -62,10 +57,6 @@ Target.create "Restore" (fun _ ->
6257
runDotnet __SOURCE_DIRECTORY__ "restore" "FSharp.Compiler.Service.sln -v n"
6358
)
6459

65-
Target.create "BuildVersion" (fun _ ->
66-
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
67-
)
68-
6960
Target.create "Build" (fun _ ->
7061
runDotnet __SOURCE_DIRECTORY__ "build" "../src/buildtools/buildtools.proj -v n -c Proto"
7162
let fslexPath = Path.GetFullPath <| Path.Combine(__SOURCE_DIRECTORY__, "../artifacts/bin/fslex/Proto/netcoreapp3.1/fslex.dll")
@@ -99,10 +90,14 @@ Target.create "GenerateDocs" (fun _ ->
9990

10091
open Fake.IO.Globbing.Operators
10192

102-
Target.create "PublishNuGet" (fun _ ->
103-
let apikey = lazy(Environment.environVarOrDefault "nuget-apikey" (UserInput.getUserPassword "Nuget API Key: "))
93+
let packagesPatterns =
10494
!! (sprintf "%s/*.%s.nupkg" releaseDir release.NugetVersion)
10595
++ (sprintf "%s/FSharp.DependencyManager.Nuget.%s.nupkg" packagesDir release.NugetVersion)
96+
97+
Target.create "PublishNuGet" (fun _ ->
98+
let apikey = lazy(Environment.environVarOrDefault "NUGET_APIKEY" (UserInput.getUserPassword "Nuget API Key: "))
99+
100+
packagesPatterns
106101
|> Seq.iter (fun nupkg ->
107102
DotNet.nugetPush (fun p -> {
108103
p with
@@ -161,6 +156,24 @@ Target.create "ValidateVersionBump" (fun _ ->
161156
""" intendedVersion parsedComputedVersion computedMagnitude apiDiffs
162157
)
163158

159+
Target.create "CreateRelease" (fun _ ->
160+
async {
161+
let client = GitHub.createClientWithToken (Environment.environVarOrDefault "GITHUB_TOKEN" (UserInput.getUserPassword "Github API Token: "))
162+
let currentSha = Git.Information.getCurrentSHA1 ""
163+
let releaseParams (input: GitHub.CreateReleaseParams) =
164+
{ input with
165+
Name = sprintf "Release %s" release.NugetVersion
166+
Body = release.Notes |> String.concat "\n"
167+
TargetCommitish = currentSha }
168+
let artifacts = packagesPatterns
169+
let! release = GitHub.createRelease "fsharp" "FSharp.Compiler.Service" assemblyVersion releaseParams client
170+
let! _release = GitHub.uploadFiles artifacts (async.Return release)
171+
return ()
172+
}
173+
|> Async.RunSynchronously
174+
)
175+
176+
164177
// --------------------------------------------------------------------------------------
165178
// Run all targets by default. Invoke 'build <Target>' to override
166179

@@ -173,7 +186,6 @@ Target.create "TestAndNuGet" ignore
173186
open Fake.Core.TargetOperators
174187

175188
"Start"
176-
=?> ("BuildVersion", isAppVeyorBuild)
177189
==> "Restore"
178190
==> "Clean"
179191
==> "Build"

fcs/paket.dependencies

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ nuget Fake.Core.UserInput
1515
nuget Fake.DotNet.Cli
1616
nuget Fake.DotNet.Fsi
1717
nuget Fake.DotNet.Paket
18+
nuget Fake.Api.Github
19+
nuget Fake.Tools.Git
1820
nuget SynVer.FAKE
1921
nuget Paket.Core
2022

fcs/paket.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ NUGET
77
Chessie (0.6)
88
FSharp.Core (>= 4.0.1.7-alpha)
99
NETStandard.Library (>= 1.6)
10+
Fake.Api.GitHub (5.20)
11+
FSharp.Core (>= 4.7.1)
12+
Octokit (>= 0.47)
1013
Fake.BuildServer.AppVeyor (5.20)
1114
Fake.Core.Environment (>= 5.20)
1215
Fake.Core.Process (>= 5.20)
@@ -204,6 +207,7 @@ NUGET
204207
NuGet.Packaging (>= 5.6)
205208
System.Dynamic.Runtime (>= 4.3)
206209
NuGet.Versioning (5.6)
210+
Octokit (0.48)
207211
Paket.Core (5.245.2)
208212
Chessie (>= 0.6)
209213
Mono.Cecil (>= 0.10.0-beta6)

0 commit comments

Comments
 (0)