Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FSSDK-9486] maint: Update CI and publishing #356

Merged
merged 34 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b9ee912
Add remote dispatch workflow
mikechu-optimizely Jul 3, 2023
dac0b37
Update job & step names
mikechu-optimizely Jul 3, 2023
afa36f9
Stop uploading to AWS
mikechu-optimizely Jul 3, 2023
fb2492a
Reorganized jobs
mikechu-optimizely Jul 3, 2023
0bbdcdd
Change workflow names
mikechu-optimizely Jul 3, 2023
f89d23a
Fix on.push.branches for testing
mikechu-optimizely Jul 3, 2023
f9feb35
Rename job
mikechu-optimizely Jul 3, 2023
df28f6a
Rename steps; remove second strong name signing
mikechu-optimizely Jul 3, 2023
0ed2133
Combine two steps
mikechu-optimizely Jul 3, 2023
8fcc432
Run tests before release build
mikechu-optimizely Jul 3, 2023
021f4d4
NIT changes
mikechu-optimizely Jul 3, 2023
f0b0f12
Move NUnit tests after build
mikechu-optimizely Jul 3, 2023
8897b78
Remove testing branch push trigger
mikechu-optimizely Jul 3, 2023
540ff46
Renamings; remove test trigger
mikechu-optimizely Jul 5, 2023
c159538
Rename jobs for consistency
mikechu-optimizely Jul 5, 2023
d33f690
Revert "Rename jobs for consistency"
mikechu-optimizely Jul 5, 2023
c152726
Update from @jaeopt PR review
mikechu-optimizely Jul 7, 2023
99ce664
Add back CI_USER_TOKEN secret
mikechu-optimizely Jul 7, 2023
9d16585
Add back TRAVIS_COM_TOKEN
mikechu-optimizely Jul 7, 2023
dbde48f
Update release workflow for testing
mikechu-optimizely Jul 7, 2023
8271b0b
Fix test tag
mikechu-optimizely Jul 7, 2023
21f264b
Testing fix use OptimizelySDK.Travis.sln since
mikechu-optimizely Jul 7, 2023
15302cc
Adjust names
mikechu-optimizely Jul 7, 2023
d488dd3
Migrate nuspec template
mikechu-optimizely Jul 7, 2023
b8de94a
Fix checkout during pack; output tag & version
mikechu-optimizely Jul 7, 2023
2555ee9
Fix output of env.TAG
mikechu-optimizely Jul 7, 2023
4589ab5
Shorten & fix during testing
mikechu-optimizely Jul 7, 2023
34401b7
Add back jobs
mikechu-optimizely Jul 7, 2023
e59f779
Update OptimizelySDK.nuspec.template's permission
mikechu-optimizely Jul 7, 2023
3e1bf5a
Iterate on nuspec creation
mikechu-optimizely Jul 7, 2023
21f591f
Fix semantic extraction
mikechu-optimizely Jul 7, 2023
ea42459
Fix dotnet nuget push
mikechu-optimizely Jul 7, 2023
7846e47
Move env to steps where they're needed
mikechu-optimizely Jul 7, 2023
a9dc592
Remove testing setups
mikechu-optimizely Jul 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 38 additions & 71 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
---
name: Csharp CI with .NET
name: Continuous Integration

on:
push:
branches: [master]
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
branches: [ master ]

jobs:
lint_code_base:
lintCodebase:
runs-on: ubuntu-latest
name: Lint Codebase
steps:
Expand All @@ -21,32 +16,17 @@ jobs:
with:
# Full git history is needed to get a proper list of changed files
fetch-depth: 0
- name: Lint codebase
- name: Run Super-Linter
uses: github/super-linter@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
VALIDATE_CSHARP: 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 Optimizely Feature Experimentation Compatibility Suite
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
with:
FULLSTACK_TEST_REPO: ProdTesting
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

unit_test:
name: Build and Run Unit Tests
netFrameworksAndUnitTest:
name: Build Framework & Run Unit Tests
needs: [ lintCodebase ]
runs-on: windows-2019 # required version for Framework 4.0
env:
REPO_SLUG: ${{ github.repository }}
Expand All @@ -63,33 +43,19 @@ jobs:
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
- name: Restore NuGet packages
# OptimizelySDK.Travis.sln isolates the .NET Framework projects from the .NET Standard projects
run: nuget restore ./OptimizelySDK.Travis.sln
- name: Build solution
- name: Build & strongly name assemblies
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: |
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 }}
- name: Install & Run NUnit tests
run: |
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 }}/$($_.Name)-unsigned }
nuget install NUnit.Console -Version 3.15.2 -DirectDownload -OutputDirectory .
# https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html
./NUnit.ConsoleRunner.3.15.2\tools\nunit3-console.exe /timeout 10000 /process Separate ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll

netStandard16:
name: Build For .NET Standard 1.6
name: Build Standard 1.6
needs: [ netFrameworksAndUnitTest ]
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
Expand All @@ -107,20 +73,12 @@ jobs:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
- name: Build and sign Standard 1.6 project
id: netStandard16_build
- name: Build & strongly name assemblies
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:
AWS_ACCESS_KEY_ID: ${{ secrets.OFTA_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OFTA_SECRET }}
AWS_DEFAULT_REGION: ${{ secrets.OFTA_REGION }}
run: |
(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
name: Build Standard 2.0
needs: [ netFrameworksAndUnitTest ]
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
Expand All @@ -138,14 +96,23 @@ jobs:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
- name: Build and sign Standard 2.0 project
id: netStandard20_build
- name: Build & strongly name assemblies
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:
AWS_ACCESS_KEY_ID: ${{ secrets.OFTA_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OFTA_SECRET }}
AWS_DEFAULT_REGION: ${{ secrets.OFTA_REGION }}
run: |
(aws s3 cp ./OptimizelySDK.NetStandard20/bin/Release/netstandard2.0/OptimizelySDK.NetStandard20.dll s3://optly-fs-travisci-artifacts/${{ env.REPO_SLUG }}/${{ env.BUILD_NUMBER }}/${{ env.RUN_NUMBER }}/${{ env.ATTEMPT_NUM }}/OptimizelySDK.NetStandard20.dll-unsigned)

integration_tests:
name: Run Integration Tests
needs: [ netFrameworksAndUnitTest, netStandard16, netStandard20 ]
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 }}
mikechu-optimizely marked this conversation as resolved.
Show resolved Hide resolved

fullstack_production_suite:
name: Run Performance Tests
needs: [ netFrameworksAndUnitTest, netStandard16, netStandard20 ]
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
with:
FULLSTACK_TEST_REPO: ProdTesting
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/csharp_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Trigger Release Workflow

on:
release:
types: [ published ] # Trigger only on published pre-releases and releases

jobs:
triggerRemoteWorkflow:
runs-on: ubuntu-latest
env:
# ⚠️ IMPORTANT: tag should always start with integer & will be used verbatim to string end
TAG: ${{ github.event.release.tag_name }}
steps:
- name: Trigger remote workflow
uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: optimizely
repo: csharp-sdk-codesign
ref: master
github_token: ${{ secrets.CI_USER_TOKEN }
workflow_file_name: publish.yml
client_payload: '{"tag": "${{ env.TAG }}"}'