Skip to content

Commit ac19d1e

Browse files
authored
Added csharp yml and integeration test github action (#298)
- Integrated git actions
1 parent 179531c commit ac19d1e

File tree

6 files changed

+182
-115
lines changed

6 files changed

+182
-115
lines changed

.github/pull_request_template.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Summary
2+
- The "what"; a concise description of each logical change
3+
- Another change
4+
5+
The "why", or other context.
6+
7+
## Test plan
8+
9+
## Issues
10+
- "THING-1234" or "Fixes #123"

.github/workflows/csharp.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
name: Csharp CI with .NET
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
jobs:
11+
lint_markdown_files:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Ruby
16+
uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: '2.6'
19+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20+
- name: Install gem
21+
run: |
22+
gem install awesome_bot
23+
- name: Run tests
24+
run: find . -type f -name '*.md' -exec awesome_bot {} \;
25+
26+
integration_tests:
27+
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
28+
secrets:
29+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
30+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
31+
32+
fullstack_production_suite:
33+
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
34+
with:
35+
FULLSTACK_TEST_REPO: ProdTesting
36+
secrets:
37+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
38+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
39+
40+
unit_test:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
- name: Setup .NET
45+
uses: actions/setup-dotnet@v1
46+
with:
47+
dotnet-version: 5.0.x
48+
- name: Restore nuget packages
49+
run: |
50+
nuget restore OptimizelySDK.Travis.sln
51+
nuget install ./OptimizelySDK.Tests/packages.config -OutputDirectory ./packages
52+
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory ./testrunner
53+
- name: script
54+
run: |
55+
./install_mono.sh
56+
xbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release ./OptimizelySDK.Travis.sln
57+
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
58+
- name: find and sign dll
59+
run: |
60+
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
61+
62+
63+
netStandard16:
64+
runs-on: windows-2022
65+
steps:
66+
- uses: actions/checkout@v3
67+
- name: Setup .NET
68+
uses: actions/setup-dotnet@v2
69+
with:
70+
dotnet-version: 3.1.x
71+
- name: Restore dependencies
72+
run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
73+
- name: Build
74+
run: |
75+
# strongname signing is taken care of in build step
76+
dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
77+
# TODO: no dotnet test yet for NetStandard16
78+
79+
netStandard20:
80+
runs-on: windows-2022
81+
steps:
82+
- uses: actions/checkout@v3
83+
- name: Setup .NET
84+
uses: actions/setup-dotnet@v2
85+
with:
86+
dotnet-version: 3.1.x
87+
- name: Restore dependencies
88+
run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
89+
- name: Build
90+
run: |
91+
# strongname signing is taken care of in build step
92+
dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=D:\a\csharp-sdk\csharp-sdk\keypair.snk -c Release
93+
# TODO: no dotnet test yet for NetStandard16
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Reusable action of running integration of production suite
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
FULLSTACK_TEST_REPO:
7+
required: false
8+
type: string
9+
secrets:
10+
CI_USER_TOKEN:
11+
required: true
12+
TRAVIS_COM_TOKEN:
13+
required: true
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
# You should create a personal access token and store it in your repository
21+
token: ${{ secrets.CI_USER_TOKEN }}
22+
repository: 'optimizely/travisci-tools'
23+
path: 'home/runner/travisci-tools'
24+
ref: 'master'
25+
- name: set SDK Branch if PR
26+
if: ${{ github.event_name == 'pull_request' }}
27+
run: |
28+
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
29+
echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
30+
- name: set SDK Branch if not pull request
31+
if: ${{ github.event_name != 'pull_request' }}
32+
run: |
33+
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
34+
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
35+
- name: Trigger build
36+
env:
37+
SDK: csharp
38+
FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }}
39+
BUILD_NUMBER: ${{ github.run_id }}
40+
TESTAPP_BRANCH: master
41+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
42+
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
43+
GITHUB_CONTEXT: ${{ toJson(github) }}
44+
TRAVIS_REPO_SLUG: ${{ github.repository }}
45+
TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
46+
UPSTREAM_REPO: ${{ github.repository }}
47+
TRAVIS_COMMIT: ${{ github.sha }}
48+
TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
49+
TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }}
50+
UPSTREAM_SHA: ${{ github.sha }}
51+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
52+
EVENT_MESSAGE: ${{ github.event.message }}
53+
HOME: 'home/runner'
54+
run: |
55+
echo "$GITHUB_CONTEXT"
56+
home/runner/travisci-tools/trigger-script-with-status-update.sh
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Source clear
2+
3+
on:
4+
schedule:
5+
# Runs "weekly"
6+
- cron: '0 0 * * 0'
7+
8+
jobs:
9+
source_clear:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Source clear scan
14+
env:
15+
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
16+
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan

.travis.yml

-115
This file was deleted.

install_mono.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
sudo apt install gnupg ca-certificates
4+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
5+
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
6+
sudo apt update
7+
sudo apt install mono-devel

0 commit comments

Comments
 (0)