Skip to content

Commit

Permalink
Adding code for security scan.
Browse files Browse the repository at this point in the history
  • Loading branch information
pvshn committed Jan 23, 2024
1 parent a330ab4 commit fb65e8d
Show file tree
Hide file tree
Showing 1,356 changed files with 96,871 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.2.0",
"commands": [
"reportgenerator"
]
},
"docfx": {
"version": "2.74.1",
"commands": [
"docfx"
]
},
"DocFxTocGenerator": {
"version": "1.17.0",
"commands": [
"DocFxTocGenerator"
]
}
}
}
102 changes: 102 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_diagnostic.CA2007.severity = warning
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_diagnostic.CA1806.severity = error
dotnet_diagnostic.CA2208.severity = error

[*.cs]
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_prefer_static_local_function = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_space_around_binary_operators = before_and_after
dotnet_diagnostic.SA0001.severity = none
dotnet_diagnostic.SA1649.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = none
dotnet_diagnostic.SA1208.severity = warning
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
dotnet_diagnostic.IDE0051.severity = error
dotnet_diagnostic.IDE0060.severity = error
csharp_style_prefer_primary_constructors = true:suggestion
25 changes: 25 additions & 0 deletions .github/actions/setup-dotnet/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup .NET
description: 'Setup .NET'

runs:
using: "composite"
steps:
- name: nuget Cache
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

PR Checklist:

- [ ] Link to GUS Item [W-123456](http:///)
- [ ] One of these Release Note Labels Applied to PR:
- `internal`
- `breaking-change`
- `feature`
- `fix`
- `documentation`
- [ ] Unit Tests
- [ ] Simulation Tests
20 changes: 20 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
changelog:
exclude:
labels:
- internal
categories:
- title: Breaking Changes
labels:
- breaking-change
- title: New Features
labels:
- feature
- title: Fixes
labels:
- fix
- title: Documentation
labels:
- documentation
- title: Other Changes
labels:
- "*"
13 changes: 13 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# GitHub Workflows

Here we have defined the workflows used for CI/CD for this SDK.
The files here are:
- dotnetworkflow.yml: This file is a template that is used by the SDK workflow. This template has the following parameters:
- runs-on-config (mandatory): indicates the runner that will run the workflow. Available runners [here](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners).
- dotnet-version (mandatory): indicates the dotnet version that will be installed on the runner. The available versions depends on the runners. Check it on the link above.
- build-config (mandatory): indicates the configuration used to build/test the sdk.
- run-tests (mandatory): indicates if the workflow will run the unit tests.
- publish-package (mandatory): indicates if the workflow will publish the artifacts (packages).
- sdk-workflow.yml: This is the real workflow that will run on every PR or every push on the defined branches.

For any changes, you can use the following documentation ([GitHub Actions Syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)) as a reference.
118 changes: 118 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# This workflow will create a new release for the current SDK
name: Create Release Workflow

on:
workflow_call:
inputs:
runs-on-config:
required: true
type: string
release-version:
required: true
type: string
is-pre-release:
required: true
type: boolean

jobs:
create-release:
runs-on: ${{ inputs.runs-on-config }}
name: Create a New Release
steps:
- name: Create Release
id: create-release
uses: actions/github-script@v6
env:
RELEASE_VERSION: ${{ inputs.release-version }}
IS_PRERELEASE: ${{ inputs.is-pre-release }}
with:
result-encoding: string
script: |
const { RELEASE_VERSION, IS_PRERELEASE } = process.env
const release_version = `release/${RELEASE_VERSION}`
const is_prerelease = IS_PRERELEASE === 'true'
const createReleaseResponse = await github.rest.repos.createRelease({
owner: context.repo.owner, // (Required) The account owner of the repository. The name is not case sensitive.
repo: context.repo.repo, // (Required) The name of the repository without the .git extension. The name is not case sensitive.
tag_name: release_version, // (Required) The name of the tag.
target_commitish: context.sha, // (Optional) Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch.
name: release_version, // (Optional) The name of the release.
// body: '', // (Optional) Text describing the contents of the tag.
// draft: true, // (Optional) true to create a draft (unpublished) release, false to create a published one.
prerelease: is_prerelease, // (Optional) true to identify the release as a prerelease. false to identify the release as a full release.
// discussion_category_name: , // (Optional) If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see "Managing categories for discussions in your repository."
// make_latest: false, // (Optional) Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to true for newly published releases. legacy specifies that the latest release should be determined based on the release creation date and higher semantic version.
generate_release_notes: true // (Optional) Whether to automatically generate the name and body for this release. If name is specified, the specified name will be used; otherwise, a name will be automatically generated. If body is specified, the body will be pre-pended to the automatically generated notes.
})
return createReleaseResponse.data.id
- uses: actions/download-artifact@v3
with:
name: docs
- uses: actions/download-artifact@v3
with:
name: nuget-package
- uses: actions/download-artifact@v3
with:
name: pypi-package
- name: Generate Bundle
run: |
zip -r bundle.zip ./Tableau.Migration.${{ inputs.release-version }}.nupkg docs.zip tableau_migration-pypi.zip
- name: Upload Release Assets
id: upload-docs
uses: actions/github-script@v6
env:
RELEASE_VERSION: ${{ inputs.release-version }}
RELEASE_ID: ${{ steps.create-release.outputs.result }}
with:
script: |
const fs = require('fs')
const { RELEASE_VERSION, RELEASE_ID } = process.env
const nuget_package = `Tableau.Migration.${RELEASE_VERSION}.nupkg`
const uploadDocsResponse = await await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner, // (Required) The account owner of the repository. The name is not case sensitive.
repo: context.repo.repo, // (Required) The name of the repository without the .git extension. The name is not case sensitive.
release_id: RELEASE_ID, // (Required) The unique identifier of the release.
name: 'docs.zip', // (Required)
label: 'Docs (zip)', // (Optional)
data: fs.readFileSync('./docs.zip') // (Optional) The raw file data.
})
const uploadNugetResponse = await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner, // (Required) The account owner of the repository. The name is not case sensitive.
repo: context.repo.repo, // (Required) The name of the repository without the .git extension. The name is not case sensitive.
release_id: RELEASE_ID, // (Required) The unique identifier of the release.
name: 'Tableau.Migration.nupkg', // (Required)
label: 'Nuget Package (nupkg)', // (Optional)
data: fs.readFileSync(nuget_package) // (Optional) The raw file data.
})
const uploadPypiResponse = await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner, // (Required) The account owner of the repository. The name is not case sensitive.
repo: context.repo.repo, // (Required) The name of the repository without the .git extension. The name is not case sensitive.
release_id: RELEASE_ID, // (Required) The unique identifier of the release.
name: 'tableau_migration-pypi.zip', // (Required)
label: 'Pypi Package (zip)', // (Optional)
data: fs.readFileSync('./tableau_migration-pypi.zip') // (Optional) The raw file data.
})
const uploadBundleResponse = await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner, // (Required) The account owner of the repository. The name is not case sensitive.
repo: context.repo.repo, // (Required) The name of the repository without the .git extension. The name is not case sensitive.
release_id: RELEASE_ID, // (Required) The unique identifier of the release.
name: 'bundle.zip', // (Required)
label: 'Bundle Package (zip)', // (Optional)
data: fs.readFileSync('./bundle.zip') // (Optional) The raw file data.
})
return {
docs: uploadDocsResponse.data,
nuget: uploadNugetResponse.data,
pypi: uploadPypiResponse.data,
bundle: uploadBundleResponse.data
}
69 changes: 69 additions & 0 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .Net Build Workflow

on:
workflow_call:
inputs:
beta-version:
required: true
type: string

env:
MIGRATIONSDK_BUILD_DOCS: 'no'
VERSION_REPLACE_ARGS: ''

jobs:
build:
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS) }}
config: ${{ fromJSON(vars.BUILD_CONFIGURATIONS) }}
runs-on: ${{ matrix.os }}
name: .Net Build ${{ matrix.os }}, ${{ matrix.config }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-dotnet
- name: Set Replaced Version Windows
if: ${{ runner.os == 'Windows' && inputs.beta-version != '' }}
run: echo "VERSION_REPLACE_ARGS=-p:Version='${{ inputs.beta-version }}'" | Out-File -FilePath $env:GITHUB_ENV -Append # no need for -Encoding utf8- uses: actions/checkout@v3
- name: Set Replaced Version Not Windows
if: ${{ runner.os != 'Windows' && inputs.beta-version != '' }}
run: echo "VERSION_REPLACE_ARGS=-p:Version='${{ inputs.beta-version }}'" >> $GITHUB_ENV
- name: Net Build Library ${{ matrix.config }} Beta Version ${{ inputs.beta-version }}
run: dotnet build '${{ vars.BUILD_SOLUTION }}' -c ${{ matrix.config }} ${{ env.VERSION_REPLACE_ARGS }}
- name: Net Publish Library ${{ matrix.config }}
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
run: dotnet publish --no-build -p:DebugType=None -p:DebugSymbols=false -c ${{ matrix.config }} -f ${{ vars.PYTHON_NETPACKAGE_FRAMEWORK }} -o './src/Python/src/tableau_migration/bin/' '${{ vars.BUILD_PROJECT }}'
- name: Net Publish Tests ${{ matrix.config }}
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
run: dotnet publish --no-build -p:DebugType=None -p:DebugSymbols=false -c ${{ matrix.config }} -f ${{ vars.PYTHON_NETPACKAGE_FRAMEWORK }} -o './dist/tests/' './tests/Tableau.Migration.Tests/Tableau.Migration.Tests.csproj'
- name: Net Publish TestComponents ${{ matrix.config }}
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
run: dotnet publish --no-build -p:DebugType=None -p:DebugSymbols=false -c ${{ matrix.config }} -f ${{ vars.PYTHON_NETPACKAGE_FRAMEWORK }} -o './dist/testcomponents/' './tests/Tableau.Migration.TestComponents/Tableau.Migration.TestComponents.csproj'
- name: Upload Published Artifacts
uses: actions/upload-artifact@v3
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
with:
name: published-${{ matrix.config }}
path: './src/Python/src/tableau_migration/bin/**'
- name: Upload Tests Artifacts
uses: actions/upload-artifact@v3
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
with:
name: tests-published-${{ matrix.config }}
path: './dist/tests/**'
- name: Upload TestComponents Artifacts
uses: actions/upload-artifact@v3
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
with:
name: testcomponents-published-${{ matrix.config }}
path: './dist/testcomponents/**'
- name: Upload Nupkg Artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.os == vars.PUBLISH_OS && matrix.config == 'Release' }}
with:
name: nuget-package
path: './src/${{ vars.NUGET_PACKAGE_FOLDER }}/bin/${{ matrix.config }}/*.nupkg'
if-no-files-found: error
Loading

0 comments on commit fb65e8d

Please sign in to comment.