generated from dolittle/DotNET_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
412 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: CI/CD Workflow | ||
|
||
env: | ||
PRERELEASE_BRANCHES: '' # Comma separated list of prerelease branch names. 'alpha,rc, ...' | ||
CASCADES: '' # Comma separated list of cascading repos. 'dolittle/DotNet.SDK,...' | ||
NUGET_OUTPUT: Artifacts/NuGet | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
context: | ||
name: Establish Context | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.context.outputs.current-version }} | ||
should-publish: ${{ steps.context.outputs.should-publish }} | ||
release-type: ${{ steps.context.outputs.release-type }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Establish context | ||
id: context | ||
uses: dolittle/establish-context-action@v2 | ||
with: | ||
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }} | ||
|
||
dot-net-ci: | ||
name: .NET CI | ||
runs-on: ubuntu-latest | ||
needs: context | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .Net | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '3.1.x' | ||
- name: Build | ||
run: dotnet build --configuration Release | ||
|
||
create-release: | ||
name: Create GitHub Release | ||
runs-on: ubuntu-latest | ||
needs: [context, dot-net-ci] | ||
|
||
if: ${{ needs.context.outputs.should-publish == 'true' }} | ||
|
||
outputs: | ||
version: ${{ steps.increment-version.outputs.next-version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Increment version | ||
id: increment-version | ||
uses: dolittle/increment-version-action@v2 | ||
with: | ||
version: ${{ needs.context.outputs.version }} | ||
release-type: ${{ needs.context.outputs.release-type }} | ||
|
||
- name: Create GitHub Release | ||
uses: dolittle/github-release-action@v1 | ||
with: | ||
cascading-release: false | ||
version: ${{ steps.increment-version.outputs.next-version }} | ||
|
||
dot-net-cd: | ||
name: .NET CD | ||
runs-on: ubuntu-latest | ||
needs: [context, dot-net-ci, create-release] | ||
|
||
if: ${{ needs.context.outputs.should-publish == 'true' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .Net | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '3.1.x' | ||
- name: Create packages | ||
run: dotnet pack --configuration Release -o ${{ env.NUGET_OUTPUT }} /p:PackageVersion=${{ needs.create-release.outputs.version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg | ||
|
||
- name: Push NuGet packages | ||
run: dotnet nuget push --skip-duplicate '${{ env.NUGET_OUTPUT }}/*.nupkg' --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
Copyright (c) Dolittle, http://www.dolittle.com | ||
MIT License | ||
|
||
This software consists of voluntary contributions made by many | ||
individuals (Authors.txt in the repository) For exact | ||
contribution history, see the revision history and logs, available | ||
at http://github.com/dolittle/DotNET.Core | ||
Copyright (c) 2019 dolittle | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26124.0 | ||
MinimumVisualStudioVersion = 15.0.26124.0 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{B76DB529-B6EA-4128-98DF-8E23EBA06A9B}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Protobuf.MSBuild", "Source\MSBuild\Protobuf.MSBuild.csproj", "{FB560E93-C095-4968-9E07-9E5DD67B9447}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Debug|x64.Build.0 = Debug|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Debug|x86.Build.0 = Debug|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Release|x64.ActiveCfg = Release|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Release|x64.Build.0 = Release|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Release|x86.ActiveCfg = Release|Any CPU | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{FB560E93-C095-4968-9E07-9E5DD67B9447} = {B76DB529-B6EA-4128-98DF-8E23EBA06A9B} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env node | ||
|
||
let toolsPath = require.resolve('grpc-tools'); | ||
let nodeModulesRoot = toolsPath.substr(0, toolsPath.indexOf('/grpc-tools')); | ||
|
||
console.log(`Using tooling from ${nodeModulesRoot}`); | ||
|
||
const path = require('path'); | ||
const glob = require('glob'); | ||
const del = require('del'); | ||
const fs = require('fs'); | ||
|
||
const { exec, execSync } = require('child_process'); | ||
|
||
if (process.argv.length < 4) { | ||
console.log('Usage:\n') | ||
console.log('dolittle_proto_build grpc-node|grpc-web -I[include path] [source path(s)]') | ||
console.log('\n'); | ||
console.log('The ordering of the arguments is important.') | ||
console.log('You can have more than one include path, just add multiple `-I` options.'); | ||
process.exit(0); | ||
return; | ||
} | ||
|
||
console.log('Delete existing declaration files'); | ||
del('./*.d.ts', '**/*.d.ts', '!node_modules/**/*', 'lib'); | ||
|
||
let args = ''; | ||
if (process.argv[2] == 'grpc-web') { | ||
args = `--plugin=protoc-gen-grpc-web=${path.join(__dirname, './grpc-web/macOS/protoc-gen-grpc-web')} `; | ||
args += '--grpc-web_out=import_style=commonjs,mode=grpcwebtext:. ' | ||
} else { | ||
args = `--plugin=protoc-gen-grpc=$nodemodules'/.bin/grpc_tools_node_protoc_plugin' `; | ||
args += `--grpc_out=./ `; | ||
} | ||
let subFolder = process.argv[3]; | ||
let hasSubFolder = subFolder !== '.'; | ||
|
||
let patterns = ['*.proto', '**/*.proto']; | ||
let ignorePatterns = ['', '*.proto']; | ||
|
||
const getAllFiles = function (dirPath, containing, arrayOfFiles) { | ||
files = fs.readdirSync(dirPath) | ||
|
||
arrayOfFiles = arrayOfFiles || [] | ||
|
||
if (dirPath.indexOf('node_modules') < 0) { | ||
|
||
files.forEach(function (file) { | ||
|
||
if (fs.statSync(dirPath + "/" + file).isDirectory()) { | ||
arrayOfFiles = getAllFiles(dirPath + "/" + file, containing, arrayOfFiles) | ||
} else { | ||
if (file.indexOf(containing) >= 0 || containing == '') { | ||
arrayOfFiles.push(path.join(dirPath, file)); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
|
||
return arrayOfFiles | ||
} | ||
|
||
for (var i = 3; i < process.argv.length; i++) { | ||
let arg = process.argv[i]; | ||
if (arg.indexOf('-') == 0) { | ||
args += `${arg} `; | ||
continue; | ||
} | ||
|
||
let folder = path.join(process.cwd(), arg); | ||
patterns.forEach((pattern, patternIndex) => { | ||
let files = glob.sync(pattern, { | ||
cwd: folder, | ||
ignore: ignorePatterns[patternIndex] | ||
}); | ||
if (files.length > 0) { | ||
args += `${path.join(arg, pattern)} `; | ||
} | ||
}); | ||
} | ||
|
||
console.log(`Looking for .proto files in '${args.trim()}'`); | ||
|
||
process.env.nodemodules = nodeModulesRoot; | ||
|
||
let scriptPath = path.join(__dirname, `generate_proxies.sh`); | ||
scriptPath = `${scriptPath} ${args.trim()}`; | ||
console.log(`Generate ${scriptPath}`) | ||
const generate = exec(`${scriptPath}`, (error, stdout, stderr) => { | ||
console.log(stdout); | ||
console.log(stderr); | ||
|
||
if (error == null) { | ||
console.log('Transpile any TypeScript files'); | ||
execSync(`npx tsc --declaration false`, { stdio: 'inherit' }); | ||
|
||
if (process.argv[2] == 'grpc-web') { | ||
console.log('Rename for web') | ||
|
||
console.log(process.cwd()); | ||
|
||
const allFiles = getAllFiles(process.cwd(), 'grpc_pb.d.ts'); | ||
allFiles.forEach(_ => fs.renameSync(_, _.replace('grpc_pb','grpc_web_pb'))); | ||
} | ||
|
||
console.log('Copy declaration files to lib') | ||
execSync(`find . -name '*.d.ts' -not -path './node_modules/*' -not -path './lib/*' | cpio -pdm ./lib`, { stdio: 'inherit' }); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
echo "Generate Proxies" | ||
find . -type f -iname '*.ts' ! -iname "index.*" -not -path './node_modules/*' -delete | ||
find . -type f -iname '*.js' ! -iname "index.*" -not -path './node_modules/*' -delete | ||
|
||
echo $* | ||
|
||
npx protoc --js_out=import_style=commonjs,binary:./ \ | ||
--ts_out=service=grpc-node:./ \ | ||
--plugin=protoc-gen-ts=$nodemodules'/.bin/protoc-gen-ts' \ | ||
$* |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@dolittle/protobuf.build", | ||
"version": "1.1.2", | ||
"description": "", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"bin": { | ||
"dolittle_proto_build": "./build.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/dolittle-tools/JavaScript.Protobuf.git" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/dolittle-tools/JavaScript.Protobuf/issues" | ||
}, | ||
"homepage": "https://github.com/dolittle-tools/JavaScript.Protobuf#readme", | ||
"dependencies": { | ||
"@types/google-protobuf": "^3.7.2", | ||
"@types/node": "^13.13.5", | ||
"del-cli": "^3.0.0", | ||
"glob": "^7.1.6", | ||
"grpc": "^1.24.2", | ||
"grpc-tools": "^1.8.1", | ||
"grpc-web": "^1.0.7", | ||
"ts-protoc-gen": "^0.12.0", | ||
"typescript": "^3.8.3" | ||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="TaskFolder;TaskAssembly"> | ||
<PropertyGroup> | ||
<DolittleProtoProject>NotSet</DolittleProtoProject> | ||
<DolittleProtoRoot>../</DolittleProtoRoot> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
<IncludeSource>True</IncludeSource> | ||
<Protobuf_NoWarnMissingExpected>true</Protobuf_NoWarnMissingExpected> | ||
</PropertyGroup> | ||
|
||
<Import Project="$(NuGetPackageRoot)grpc.tools/2.23.0/build/Grpc.Tools.props"/> | ||
<Import Project="$(NuGetPackageRoot)grpc.tools/2.23.0/build/Grpc.Tools.targets"/> | ||
|
||
<ItemGroup> | ||
<Protobuf Include="$(DolittleProtoProject)/**/*.proto" | ||
ProtoRoot="$(DolittleProtoRoot)" | ||
OutputDir="%(RecursiveDir)" | ||
GrpcServices="Both" | ||
CompileOutputs="False" /> | ||
</ItemGroup> | ||
|
||
<Target Name="DeleteSourceFiles" BeforeTargets="BeforeBuild"> | ||
<ItemGroup> | ||
<FilesToDelete Include="**/*.cs"/> | ||
</ItemGroup> | ||
<Delete Files="@(FilesToDelete)"/> | ||
</Target> | ||
</Project> |
Oops, something went wrong.