-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Boris Bujak <[email protected]> Co-authored-by: Oscar Hinton <[email protected]>
- Loading branch information
1 parent
58dbf9b
commit 662a92d
Showing
30 changed files
with
1,183 additions
and
137 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,78 @@ | ||
name: Build .NET SDK | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
generate_schemas: | ||
uses: ./.github/workflows/generate_schemas.yml | ||
|
||
build_rust: | ||
uses: ./.github/workflows/build-rust-cross-platform.yml | ||
|
||
build_dotnet: | ||
name: Build .NET | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- generate_schemas | ||
- build_rust | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- name: Download C# schemas artifact | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: schemas.cs | ||
path: languages/csharp/Bitwarden.Sdk | ||
|
||
- name: Set up .NET Core | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
with: | ||
global-json-file: languages/csharp/global.json | ||
|
||
- name: Download x86_64-apple-darwin files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-x86_64-apple-darwin | ||
path: languages/csharp/Bitwarden.Sdk/macos-x64 | ||
|
||
- name: Download aarch64-apple-darwin files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-aarch64-apple-darwin | ||
path: languages/csharp/Bitwarden.Sdk/macos-arm64 | ||
|
||
- name: Download x86_64-unknown-linux-gnu files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-x86_64-unknown-linux-gnu | ||
path: languages/csharp/Bitwarden.Sdk/ubuntu-x64 | ||
|
||
- name: Download x86_64-pc-windows-msvc files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-x86_64-pc-windows-msvc | ||
path: languages/csharp/Bitwarden.Sdk/windows-x64 | ||
|
||
- name: Build .NET 6 Project | ||
working-directory: languages/csharp/Bitwarden.Sdk | ||
run: | | ||
dotnet restore | ||
dotnet build --configuration Release | ||
- name: Pack NuGet Package | ||
env: | ||
VERSION: 0.0.1 | ||
run: dotnet pack --configuration Release -p:PackageID=Bitwarden.Sdk -p:Version=${VERSION} --output ./nuget-output /nologo /v:n | ||
working-directory: languages/csharp/Bitwarden.Sdk | ||
|
||
- name: Upload NuGet package | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: Bitwarden.Sdk.0.0.1.nupkg | ||
path: | | ||
./languages/csharp/Bitwarden.Sdk/nuget-output/*.nupkg |
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,48 @@ | ||
name: Build Rust Cross Platform | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build_rust: | ||
name: Build for ${{ matrix.settings.os }} ${{ matrix.settings.target }} | ||
runs-on: ${{ matrix.settings.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
settings: | ||
- os: macos-12 | ||
target: x86_64-apple-darwin | ||
- os: macos-12 | ||
target: aarch64-apple-darwin | ||
- os: windows-2022 | ||
target: x86_64-pc-windows-msvc | ||
- os: ubuntu-22.04 | ||
target: x86_64-unknown-linux-gnu | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- name: Install rust | ||
uses: dtolnay/rust-toolchain@f361669954a8ecfc00a3443f35f9ac8e610ffc06 # stable | ||
with: | ||
toolchain: stable | ||
|
||
- name: Cache cargo registry | ||
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # v2.6.2 | ||
|
||
- name: Add build architecture | ||
run: rustup target add ${{ matrix.settings.target }} | ||
|
||
- name: Build Rust | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
run: cargo build --target ${{ matrix.settings.target }} --release | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: libbitwarden_c_files-${{ matrix.settings.target }} | ||
path: | | ||
target/${{ matrix.settings.target }}/release/*bitwarden_c* |
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
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,69 @@ | ||
name: Deploy NuGet Package | ||
|
||
on: | ||
workflow_dispatch: | ||
version_number: | ||
description: "New Version" | ||
required: true | ||
|
||
jobs: | ||
generate_schemas: | ||
uses: ./.github/workflows/generate_schemas.yml | ||
|
||
build_rust: | ||
uses: ./.github/workflows/build-rust-cross-platform.yml | ||
|
||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- generate_schemas | ||
- build_rust | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- name: Download C# schemas artifact | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: schemas.cs | ||
path: languages/csharp/Bitwarden.Sdk | ||
|
||
- name: Set up .NET Core | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
with: | ||
global-json-file: languages/csharp/global.json | ||
|
||
- name: Download x86_64-apple-darwin files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-x86_64-apple-darwin | ||
path: languages/csharp/Bitwarden.Sdk/macos-x64 | ||
|
||
- name: Download aarch64-apple-darwin files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-aarch64-apple-darwin | ||
path: languages/csharp/Bitwarden.Sdk/macos-arm64 | ||
|
||
- name: Download x86_64-unknown-linux-gnu files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-x86_64-unknown-linux-gnu | ||
path: languages/csharp/Bitwarden.Sdk/ubuntu-x64 | ||
|
||
- name: Download x86_64-pc-windows-msvc files | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: libbitwarden_c_files-x86_64-pc-windows-msvc | ||
path: languages/csharp/Bitwarden.Sdk/windows-x64 | ||
|
||
- name: Pack NuGet Package | ||
env: | ||
VERSION: ${{ github.event.inputs.version_number }} | ||
run: dotnet pack --configuration Release -p:PackageID=Bitwarden.Sdk -p:Version=${VERSION} --output ./nuget-output /nologo /v:n | ||
working-directory: languages/csharp/Bitwarden.Sdk | ||
|
||
- name: Publish NuGet Package | ||
run: dotnet nuget push ./languages/csharp/Bitwarden.Sdk/nuget-output/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |
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
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
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,6 +1,7 @@ | ||
{ | ||
"cSpell.words": [ | ||
"bindgen", | ||
"Bitwarden", | ||
"Cdecl", | ||
"chrono", | ||
"cloc", | ||
|
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
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,125 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Don't use tabs for indentation. | ||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
guidelines = 120 | ||
# (Please don't specify an indent_size here; that has too many unintended consequences.) | ||
|
||
# Code files | ||
[*.{cs,csx,vb,vbx}] | ||
indent_size = 4 | ||
charset = utf-8-bom | ||
|
||
# Xml project files | ||
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] | ||
indent_size = 2 | ||
|
||
# Xml config files | ||
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] | ||
indent_size = 2 | ||
|
||
# JSON files | ||
[*.json] | ||
indent_size = 2 | ||
|
||
# Dotnet code style settings: | ||
[*.{cs,vb}] | ||
# Sort using and Import directives with System.* appearing first | ||
dotnet_sort_system_directives_first = true | ||
# Avoid "this." and "Me." if not necessary | ||
dotnet_style_qualification_for_field = false:suggestion | ||
dotnet_style_qualification_for_property = false:suggestion | ||
dotnet_style_qualification_for_method = false:suggestion | ||
dotnet_style_qualification_for_event = false:suggestion | ||
|
||
# Use language keywords instead of framework type names for type references | ||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion | ||
dotnet_style_predefined_type_for_member_access = true:suggestion | ||
|
||
# Suggest more modern language features when available | ||
dotnet_style_object_initializer = true:suggestion | ||
dotnet_style_collection_initializer = true:suggestion | ||
dotnet_style_coalesce_expression = true:suggestion | ||
dotnet_style_null_propagation = true:suggestion | ||
dotnet_style_explicit_tuple_names = true:suggestion | ||
|
||
# Prefix private members with underscore | ||
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields | ||
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore | ||
dotnet_naming_rule.private_members_with_underscore.severity = suggestion | ||
|
||
dotnet_naming_symbols.private_fields.applicable_kinds = field | ||
dotnet_naming_symbols.private_fields.applicable_accessibilities = private | ||
|
||
dotnet_naming_style.prefix_underscore.capitalization = camel_case | ||
dotnet_naming_style.prefix_underscore.required_prefix = _ | ||
|
||
# Async methods should have "Async" suffix | ||
dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods | ||
dotnet_naming_rule.async_methods_end_in_async.style = end_in_async | ||
dotnet_naming_rule.async_methods_end_in_async.severity = suggestion | ||
|
||
dotnet_naming_symbols.any_async_methods.applicable_kinds = method | ||
dotnet_naming_symbols.any_async_methods.applicable_accessibilities = * | ||
dotnet_naming_symbols.any_async_methods.required_modifiers = async | ||
|
||
dotnet_naming_style.end_in_async.required_prefix = | ||
dotnet_naming_style.end_in_async.required_suffix = Async | ||
dotnet_naming_style.end_in_async.capitalization = pascal_case | ||
dotnet_naming_style.end_in_async.word_separator = | ||
|
||
# Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items. | ||
dotnet_diagnostic.CS0618.severity = suggestion | ||
|
||
# Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items. | ||
dotnet_diagnostic.CS0612.severity = suggestion | ||
|
||
# Remove unnecessary using directives https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005 | ||
dotnet_diagnostic.IDE0005.severity = warning | ||
|
||
# CSharp code style settings: | ||
[*.cs] | ||
# Prefer "var" everywhere | ||
csharp_style_var_for_built_in_types = true:suggestion | ||
csharp_style_var_when_type_is_apparent = true:suggestion | ||
csharp_style_var_elsewhere = true:suggestion | ||
|
||
# Prefer method-like constructs to have a expression-body | ||
csharp_style_expression_bodied_methods = true:none | ||
csharp_style_expression_bodied_constructors = true:none | ||
csharp_style_expression_bodied_operators = true:none | ||
|
||
# Prefer property-like constructs to have an expression-body | ||
csharp_style_expression_bodied_properties = true:none | ||
csharp_style_expression_bodied_indexers = true:none | ||
csharp_style_expression_bodied_accessors = true:none | ||
|
||
# Suggest more modern language features when available | ||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion | ||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion | ||
csharp_style_inlined_variable_declaration = true:suggestion | ||
csharp_style_throw_expression = true:suggestion | ||
csharp_style_conditional_delegate_call = true:suggestion | ||
|
||
# Newline settings | ||
csharp_new_line_before_open_brace = all | ||
csharp_new_line_before_else = true | ||
csharp_new_line_before_catch = true | ||
csharp_new_line_before_finally = true | ||
csharp_new_line_before_members_in_object_initializers = true | ||
csharp_new_line_before_members_in_anonymous_types = true | ||
|
||
# Namespace settings | ||
csharp_style_namespace_declarations = file_scoped:warning | ||
|
||
# Switch expression | ||
dotnet_diagnostic.CS8509.severity = error # missing switch case for named enum value | ||
dotnet_diagnostic.CS8524.severity = none # missing switch case for unnamed enum value |
14 changes: 14 additions & 0 deletions
14
languages/csharp/Bitwarden.Sdk.Samples/Bitwarden.Sdk.Samples.csproj
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Bitwarden.Sdk\Bitwarden.Sdk.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.