Skip to content

Commit

Permalink
chore: Fix and Reconfigure GitHub Actions (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikechu-optimizely authored and NomanShoaib committed Mar 16, 2023
1 parent acb06c2 commit 394adfd
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 57 deletions.
24 changes: 10 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ root = true
#### Core EditorConfig Options ####

# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4

# New line preferences
end_of_line = crlf
insert_final_newline = false
insert_final_newline = true

#### .NET Coding Conventions ####

Expand Down Expand Up @@ -198,33 +195,33 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

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.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.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 =
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

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.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.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.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
end_of_line = lf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
Expand All @@ -240,4 +237,3 @@ dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion

83 changes: 45 additions & 38 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,39 @@ on:
branches: [master]
pull_request:
branches: [master]

env:
RELEASE_BRANCH: "master"
WINDOWS_2019_SN_PATH: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe

jobs:
lint_code_base:
runs-on: ubuntu-latest
name: Lint Code Base
name: Lint Codebase
steps:
- name: Checkout Code
- name: Checkout code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files
fetch-depth: 0
- name: Lint Code Base
- name: Lint codebase
uses: github/super-linter@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
VALIDATE_CSHARP: true
VALIDATE_MARKDOWN: true

integration_tests:
name: Run Integration Tests
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

fullstack_production_suite:
name: Run Full Stack Compatibility Suite
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
with:
FULLSTACK_TEST_REPO: ProdTesting
Expand All @@ -43,7 +47,8 @@ jobs:
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

unit_test:
runs-on: ubuntu-latest
name: Build and Run Unit Tests
runs-on: windows-2019 # required version for Framework 4.0
env:
REPO_SLUG: ${{ github.repository }}
BUILD_NUMBER: ${{ github.run_id }}
Expand All @@ -52,35 +57,40 @@ jobs:
EVENT_TYPE: ${{ github.event_name }}
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore nuget packages
run: |
nuget restore OptimizelySDK.Travis.sln
nuget install ./OptimizelySDK.Tests/packages.config -OutputDirectory ./packages
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory ./testrunner
- name: script
run: |
./install_mono.sh
xbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.Travis.sln
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
- name: find and sign dll
- name: Checkout code
uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
- name: Restore NuGet packages
run: nuget restore ./OptimizelySDK.Travis.sln
- name: Build solution
run: msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.Travis.sln
- name: Install NUnit Console
run: nuget install NUnit.Console -Version 3.15.2 -DirectDownload -OutputDirectory .
- name: Run NUnit tests
# https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html
run: ./NUnit.ConsoleRunner.3.15.2\tools\nunit3-console.exe /timeout 10000 /process Separate ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
- name: Find and sign all DLLs
id: unit_tests
run: |
sudo find . -path './OptimizelySDK*bin/Release/OptimizelySDK*.dll' -not -regex '.*Tests.*' -print0 | while IFS= read -r -d '' file; do sn -R $file ./keypair.snk; done
- name: Check on success
Get-ChildItem -Recurse -Exclude '.*Tests.*' -Include 'OptimizelySDK*.dll' |
Where-Object { $_.DirectoryName -match '\\bin\\Release' } |
Foreach-Object { & $env:WINDOWS_2019_SN_PATH -R $_.FullName ./keypair.snk }
- name: Install AWS CLI, deploy to S3 on successful tests & for release
if: steps.unit_tests.outcome == 'success' && env.CURRENT_BRANCH == env.RELEASE_BRANCH && env.EVENT_TYPE == 'push'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.OFTA_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OFTA_SECRET }}
AWS_DEFAULT_REGION: ${{ secrets.OFTA_REGION }}
run: |
find . -path './OptimizelySDK*bin/Release/OptimizelySDK*.dll' -not -regex '.*Tests.*' -print0 | while IFS= read -r -d '' file; do (aws s3 cp $file s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/$(basename $file)-unsigned); done
Install-Module -Name AWS.Tools.Installer -Force;
Install-AWSToolsModule AWS.Tools.S3 -Force -CleanUp;
Get-ChildItem -Recurse -Exclude '.*Tests.*' -include 'OptimizelySDK*.dll' | Where-Object { $_.DirectoryName -match '\\bin\\Release' } | Foreach-Object { aws s3 cp $_.FullName s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/$(basename $file)-unsigned }
netStandard16:
name: Build For .NET Standard 1.6
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
Expand All @@ -90,19 +100,17 @@ jobs:
EVENT_TYPE: ${{ github.event_name }}
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
- name: Build
- name: Build and sign Standard 1.6 project
id: netStandard16_build
run: |
# strongname signing is taken care of in build step
dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
# TODO: no dotnet test yet for NetStandard16
run: dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
- name: Check on success
if: steps.netStandard16_build.outcome == 'success' && env.CURRENT_BRANCH == env.RELEASE_BRANCH && env.EVENT_TYPE == 'push'
env:
Expand All @@ -113,6 +121,7 @@ jobs:
(aws s3 cp ./OptimizelySDK.NetStandard16/bin/Release/netstandard1.6/OptimizelySDK.NetStandard16.dll s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/OptimizelySDK.NetStandard16.dll-unsigned)
netStandard20:
name: Build For .NET Standard 2.0
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
Expand All @@ -122,19 +131,17 @@ jobs:
EVENT_TYPE: ${{ github.event_name }}
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
- name: Build
- name: Build and sign Standard 2.0 project
id: netStandard20_build
run: |
# strongname signing is taken care of in build step
dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
# TODO: no dotnet test yet for NetStandard20
run: dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
- name: Check on success
if: steps.netStandard20_build.outcome == 'success' && env.CURRENT_BRANCH == env.RELEASE_BRANCH && env.EVENT_TYPE == 'push'
env:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/ticket_reference_check.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Jira ticket reference check
name: Jira Ticket Reference Check

on:
pull_request:
types: [opened, edited, reopened, synchronize]
types: [opened, edited, reopened, synchronize]

jobs:

jira_ticket_reference_check:
runs-on: ubuntu-latest

steps:
- name: Check for Jira ticket reference
uses: optimizely/github-action-ticket-reference-checker-public@master
Expand Down
2 changes: 1 addition & 1 deletion OptimizelySDK.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<configSections>
<section name="optlySDKConfigSection"
type="OptimizelySDK.OptimizelySDKConfigSection, OptimizelySDK, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null" />
type="OptimizelySDK.OptimizelySDKConfigSection, OptimizelySDK" />
</configSections>

<optlySDKConfigSection>
Expand Down

0 comments on commit 394adfd

Please sign in to comment.