Skip to content

Added csharp yml and integeration test github action #298

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

Merged
merged 32 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
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
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Summary
- The "what"; a concise description of each logical change
- Another change

The "why", or other context.

## Test plan

## Issues
- "THING-1234" or "Fixes #123"
93 changes: 93 additions & 0 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

name: Csharp CI with .NET

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint_markdown_files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install gem
run: |
gem install awesome_bot
- name: Run tests
run: find . -type f -name '*.md' -exec awesome_bot {} \;

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:
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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkout@v3? can we use the same version across all sdks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkout@v3? can we use the same version across all sdks.

- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the result with msbuild?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the result with msbuild?

mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
- name: find and sign dll
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


netStandard16:
runs-on: windows-2022
steps:
- 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
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

netStandard20:
runs-on: windows-2022
steps:
- 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
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 NetStandard16
56 changes: 56 additions & 0 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Reusable action of running integration of production suite

on:
workflow_call:
inputs:
FULLSTACK_TEST_REPO:
required: false
type: string
secrets:
CI_USER_TOKEN:
required: true
TRAVIS_COM_TOKEN:
required: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# You should create a personal access token and store it in your repository
token: ${{ secrets.CI_USER_TOKEN }}
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
- name: set SDK Branch if PR
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
- name: set SDK Branch if not pull request
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Trigger build
env:
SDK: csharp
FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }}
BUILD_NUMBER: ${{ github.run_id }}
TESTAPP_BRANCH: master
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
GITHUB_CONTEXT: ${{ toJson(github) }}
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
UPSTREAM_REPO: ${{ github.repository }}
TRAVIS_COMMIT: ${{ github.sha }}
TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }}
UPSTREAM_SHA: ${{ github.sha }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
EVENT_MESSAGE: ${{ github.event.message }}
HOME: 'home/runner'
run: |
echo "$GITHUB_CONTEXT"
home/runner/travisci-tools/trigger-script-with-status-update.sh
16 changes: 16 additions & 0 deletions .github/workflows/source_clear_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Source clear

on:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put master only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions only runs scheduled jobs on the default branch of your repository (usually master or main)

schedule:
# Runs "weekly"
- cron: '0 0 * * 0'

jobs:
source_clear:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Source clear scan
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan
115 changes: 0 additions & 115 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions install_mono.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel