-
Notifications
You must be signed in to change notification settings - Fork 20
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
chore: Fix and Reconfigure GitHub Actions #319
Changes from all commits
35d7921
05c59f9
c78e858
c5e07ac
7f30fe5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 }} | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move it before running msbuild. SO all setups can be seen together. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. That makes sense. I intended to only execute installations before they were needed in case of failure. eg If build failed, no need to install NUnit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 Thinking more on this… I'd like to think green and code sustainably here. By performing the installation only if and just before it's needed, we're reducing the amount of resources (albeit small) being used on a potentially unnecessary step. If you feel strongly over this re-ordering, please DM me on Teams, and I'll roll it into another PR. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to have, if you can specify each parameter what it does. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, that's a great idea. Yes. I'll add a comment. |
||
- 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 }} | ||
|
@@ -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: | ||
|
@@ -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 }} | ||
|
@@ -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: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please run OptimizelySDK.sln instead of OptimizelySDK.Travis.sln
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
OptimizelySDK.Travis.sln
does not include the demo app OptimizelySDK.DemoApp.csproj which has build errors.I'm guessing the demo app was not needed, so someone created the Travis version.
In later sprints, I think we should fix or remove the demo app.
It's likely safe to continue to build the Travis solution instead.