-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdefault.ps1
97 lines (83 loc) · 4.4 KB
/
default.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
properties {
$base_dir = resolve-path .
$build_dir = "$base_dir\build"
$source_dir = "$base_dir\src"
$result_dir = "$build_dir\results"
$global:config = "debug"
$tag = $(git tag -l --points-at HEAD)
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$suffix = @{ $true = ""; $false = "ci-$revision"}[$tag -ne $NULL -and $revision -ne "local"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
$versionSuffix = @{ $true = "--version-suffix=$($suffix)"; $false = ""}[$suffix -ne ""]
}
# CI tasks
task ci -depends compile, publishDockerEventMeshService, publishEventMeshCLI
task clean {
rd "$source_dir\artifacts" -recurse -force -ErrorAction SilentlyContinue | out-null
rd "$base_dir\build" -recurse -force -ErrorAction SilentlyContinue | out-null
}
task compile -depends clean {
echo "build: Tag is $tag"
echo "build: Package version suffix is $suffix"
echo "build: Build version suffix is $buildSuffix"
exec { dotnet --version }
exec { dotnet --info }
exec { msbuild -version }
exec { dotnet build .\FaasNet.RaftConsensus.sln -c $config --version-suffix=$buildSuffix }
exec { dotnet build .\FaasNet.EventMesh.sln -c $config --version-suffix=$buildSuffix }
}
# Publish EventMesh
task publishDockerEventMeshService {
rd "$result_dir\eventMeshService" -recurse -force -ErrorAction SilentlyContinue | out-null
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Service\FaasNet.EventMesh.Service.csproj -c $config -o $result_dir\eventMeshService }
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Protocols.AMQP\FaasNet.EventMesh.Protocols.AMQP.csproj -c $config -o $result_dir\protocolPlugins\FaasNet.EventMesh.Protocols.AMQP }
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Protocols.WebSocket\FaasNet.EventMesh.Protocols.WebSocket.csproj -c $config -o $result_dir\protocolPlugins\FaasNet.EventMesh.Protocols.WebSocket }
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Sink.AMQP\FaasNet.EventMesh.Sink.AMQP.csproj -c $config -o $result_dir\sinkPlugins\FaasNet.EventMesh.Sink.AMQP }
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Sink.Kafka\FaasNet.EventMesh.Sink.Kafka.csproj -c $config -o $result_dir\sinkPlugins\FaasNet.EventMesh.Sink.Kafka }
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMesh.Sink.VpnBridge\FaasNet.EventMesh.Sink.VpnBridge.csproj -c $config -o $result_dir\sinkPlugins\FaasNet.EventMesh.Sink.VpnBridge }
exec { dotnet publish $source_dir\RaftConsensus\FaasNet.RaftConsensus.Discovery.Config\FaasNet.RaftConsensus.Discovery.Config.csproj -c $config -o $result_dir\discoveryPlugins\FaasNet.RaftConsensus.Discovery.Config }
exec { dotnet publish $source_dir\RaftConsensus\FaasNet.RaftConsensus.Discovery.Etcd\FaasNet.RaftConsensus.Discovery.Etcd.csproj -c $config -o $result_dir\discoveryPlugins\FaasNet.RaftConsensus.Discovery.Etcd }
}
task publishEventMeshCLI {
exec { dotnet publish $source_dir\EventMesh\FaasNet.EventMeshCTL.CLI\FaasNet.EventMeshCTL.CLI.csproj -c $config -o $result_dir\eventMeshCLI }
}
# Publish
task publishWebsite {
exec { git checkout gh-pages }
exec { git rm -r . }
exec { git checkout HEAD -- .gitignore }
exec { git add . }
exec { git commit -m "Remove" }
exec { git checkout master }
exec { docfx ./docs/docfx.json }
exec { Copy-item -Force -Recurse -Verbose "./docs/_site/*" -Destination "." }
exec { git checkout gh-pages --merge }
exec { git add . }
exec { git commit -m "Update Documentation" }
exec { git rebase -i HEAD~2 }
exec { git push origin gh-pages }
exec { git checkout master }
}
# Test
task test {
Push-Location -Path $base_dir\tests\FaasNet.EventMesh.Runtime.Tests
try {
exec { & dotnet test -c $config --no-build --no-restore }
} finally {
Pop-Location
}
Push-Location -Path $base_dir\tests\FaasNet.RaftConsensus.Tests
try {
exec { & dotnet test -c $config --no-build --no-restore }
} finally {
Pop-Location
}
}
# Publish Docker
task publishDockerEventMesh {
[xml]$XmlDoc = Get-Content -Path .\Directory.Build.props
$VersionPrefix = $XmlDoc.Project.PropertyGroup.VersionPrefix
docker build -t simpleidserver/faaseventmesh:$VersionPrefix -f EventMeshDockerFile .
docker push simpleidserver/faaseventmesh:$VersionPrefix
}