Skip to content

Commit a17e6e5

Browse files
committed
Initial workflow settings
1 parent f620dc0 commit a17e6e5

9 files changed

+342
-21
lines changed

.gitattributes

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain
+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: "Post-Integration"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- '!stable'
8+
- '!release'
9+
10+
env:
11+
ATC_EMAIL: '[email protected]'
12+
ATC_NAME: 'Atc-Net'
13+
NUGET_REPO_URL: 'https://nuget.pkg.github.com/atc-net/index.json'
14+
15+
jobs:
16+
merge-to-stable:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 🛒 Checkout repository
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
token: ${{ secrets.PAT_WORKFLOWS }}
24+
25+
- name: ⚛️ Sets environment variables - branch-name
26+
uses: nelonoel/[email protected]
27+
28+
- name: ⚛️ Sets environment variables - Nerdbank.GitVersioning
29+
uses: dotnet/nbgv@master
30+
with:
31+
setAllVars: true
32+
33+
- name: ⚙️ Setup dotnet 5.0.x
34+
uses: actions/setup-dotnet@v1
35+
with:
36+
dotnet-version: '5.0.x'
37+
38+
- name: ⚙️ Set up JDK 11
39+
uses: actions/setup-java@v1
40+
with:
41+
java-version: 1.11
42+
43+
- name: 🧹 Clean
44+
run: dotnet clean -c Release && dotnet nuget locals all --clear
45+
46+
- name: 🔁 Restore packages
47+
run: dotnet restore
48+
49+
- name: 🛠️ Build
50+
run: dotnet build -c Release --no-restore /p:UseSourceLink=true
51+
52+
- name: 🧪 Run unit tests
53+
run: dotnet test -c Release --no-build
54+
55+
- name: 🌩️ SonarCloud install scanner
56+
run: dotnet tool install --global dotnet-sonarscanner
57+
58+
- name: 🌩️ SonarCloud analyze
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
62+
shell: pwsh
63+
run: |
64+
dotnet sonarscanner begin /k:"atc-rest-client" /o:"atc-net" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
65+
dotnet build -c Release /p:UseSourceLink=true --no-restore
66+
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
67+
68+
- name: ⏩ Merge to stable-branch
69+
run: |
70+
git config --local user.email ${{ env.ATC_EMAIL }}
71+
git config --local user.name ${{ env.ATC_NAME }}
72+
git checkout stable
73+
git merge --ff-only main
74+
git push origin stable
75+
76+
- name: 🗳️ Creating library package for pre-release
77+
run: dotnet pack -c Release --no-restore -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH_NAME
78+
79+
- name: 📦 Push packages to GitHub Package Registry
80+
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'Atc.Cosmos.'${NBGV_NuGetPackageVersion}'.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate

.github/workflows/pre-integration.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Pre-Integration"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
10+
jobs:
11+
dotnet5-build:
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- name: 🛒 Checkout repository
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: ⚙️ Setup dotnet 5.0.x
23+
uses: actions/setup-dotnet@v1
24+
with:
25+
dotnet-version: '5.0.x'
26+
27+
- name: 🧹 Clean
28+
run: dotnet clean -c Release && dotnet nuget locals all --clear
29+
30+
- name: 🔁 Restore packages
31+
run: dotnet restore
32+
33+
- name: 🛠️ Building library in release mode
34+
run: dotnet build -c Release --no-restore
35+
36+
dotnet-test:
37+
runs-on: ubuntu-latest
38+
needs:
39+
- dotnet5-build
40+
steps:
41+
- name: 🛒 Checkout repository
42+
uses: actions/checkout@v2
43+
with:
44+
fetch-depth: 0
45+
46+
- name: ⚙️ Setup dotnet 5.0.x
47+
uses: actions/setup-dotnet@v1
48+
with:
49+
dotnet-version: '5.0.x'
50+
51+
- name: 🔁 Restore packages
52+
run: dotnet restore
53+
54+
- name: 🛠️ Build
55+
run: dotnet build -c Release --no-restore /p:UseSourceLink=true
56+
57+
- name: 🧪 Run unit tests
58+
run: dotnet test -c Release --no-build

.github/workflows/release.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Release"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
ATC_EMAIL: '[email protected]'
8+
ATC_NAME: 'Atc-Net'
9+
NUGET_REPO_URL: 'https://api.nuget.org/v3/index.json'
10+
11+
jobs:
12+
release:
13+
if: github.ref == 'refs/heads/stable'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 🛒 Checkout repository
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
token: ${{ secrets.PAT_WORKFLOWS }}
21+
22+
- name: ⚛️ Sets environment variables - branch-name
23+
uses: nelonoel/[email protected]
24+
25+
- name: ⚛️ Sets environment variables - Nerdbank.GitVersioning
26+
uses: dotnet/nbgv@master
27+
with:
28+
setAllVars: true
29+
30+
- name: ⚙️ Setup dotnet 5.0.x
31+
uses: actions/setup-dotnet@v1
32+
with:
33+
dotnet-version: '5.0.x'
34+
35+
- name: 🧹 Clean
36+
run: dotnet clean -c Release && dotnet nuget locals all --clear
37+
38+
- name: 🔁 Restore packages
39+
run: dotnet restore
40+
41+
- name: 🛠️ Building library in release mode
42+
run: dotnet build -c Release --no-restore /p:UseSourceLink=true
43+
44+
- name: ⏩ Merge to release-branch
45+
run: |
46+
git config --local user.email ${{ env.ATC_EMAIL }}
47+
git config --local user.name ${{ env.ATC_NAME }}
48+
git checkout release
49+
git merge --ff-only stable
50+
git push origin release
51+
52+
- name: 🗳️ Creating library package for release
53+
run: dotnet pack -c Release --no-restore -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH_NAME /p:PublicRelease=true
54+
55+
- name: 📦 Push packages to NuGet
56+
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'Atc.Rest.Client.'${NBGV_NuGetPackageVersion}'.nupkg' -k ${{ secrets.NUGET_KEY }} -s ${{ env.NUGET_REPO_URL }} --skip-duplicate

Atc.Rest.Client.sln

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".files", ".files", "{B301C360-29E2-4F7B-93DA-58F8EBF1C822}"
1111
ProjectSection(SolutionItems) = preProject
1212
.editorconfig = .editorconfig
13+
.gitattributes = .gitattributes
1314
.gitignore = .gitignore
1415
version.json = version.json
1516
EndProjectSection
@@ -32,6 +33,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D98D5EEC
3233
test\directory.build.props = test\directory.build.props
3334
EndProjectSection
3435
EndProject
36+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{F9CE297B-0564-4B04-8B57-F3B355B0BFBC}"
37+
EndProject
38+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{481A7563-CDD1-4273-BE94-EC1A8C9080A7}"
39+
ProjectSection(SolutionItems) = preProject
40+
.github\workflows\post-integration.yml = .github\workflows\post-integration.yml
41+
.github\workflows\pre-integration.yml = .github\workflows\pre-integration.yml
42+
.github\workflows\release.yml = .github\workflows\release.yml
43+
EndProjectSection
44+
EndProject
3545
Global
3646
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3747
Debug|Any CPU = Debug|Any CPU
@@ -53,6 +63,7 @@ Global
5363
GlobalSection(NestedProjects) = preSolution
5464
{15A96F3F-4F3D-471D-885F-8C817EE0799E} = {6F93C17A-E567-4E32-AE28-5AF20CBC7A2B}
5565
{2286E363-C6E4-41AB-9A03-FC8C4C8FEB79} = {D98D5EEC-459E-40AF-8C0F-92F03BF084C4}
66+
{481A7563-CDD1-4273-BE94-EC1A8C9080A7} = {F9CE297B-0564-4B04-8B57-F3B355B0BFBC}
5667
EndGlobalSection
5768
GlobalSection(ExtensibilityGlobals) = postSolution
5869
SolutionGuid = {7A92D7EC-F444-456B-A86C-D6683E016C35}

Directory.Build.props

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

4+
<PropertyGroup Label="Metadata configuration">
5+
<OrganizationName>atc-net</OrganizationName>
6+
<RepositoryName>atc-rest-client</RepositoryName>
7+
</PropertyGroup>
8+
49
<!-- Solution wide properties -->
510
<PropertyGroup Label="Assembly Naming">
6-
<Company>CompanyName</Company>
7-
<Authors>CompanyName</Authors>
11+
<Company>$(OrganizationName)</Company>
12+
<Authors>$(OrganizationName)</Authors>
813
<NeutralLanguage>en</NeutralLanguage>
914
<DefaultLanguage>en-US</DefaultLanguage>
1015
</PropertyGroup>
@@ -24,7 +29,7 @@
2429
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
2530
<EnableNETAnalyzers>true</EnableNETAnalyzers>
2631
<AnalysisLevel>latest</AnalysisLevel>
27-
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
32+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
2833
</PropertyGroup>
2934

3035
<!-- Treat warnings as errors are always on when building in release -->
@@ -35,12 +40,11 @@
3540
<!-- Shared code analyzers used for all projects in the solution -->
3641
<ItemGroup Label="Code Analyzers">
3742
<PackageReference Include="AsyncFixer" Version="1.5.1" PrivateAssets="All" />
38-
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
39-
<PackageReference Include="Meziantou.Analyzer" Version="1.0.606" PrivateAssets="All" />
40-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" PrivateAssets="All" />
41-
<PackageReference Include="SecurityCodeScan" Version="3.5.3" PrivateAssets="All" />
43+
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="all" />
44+
<PackageReference Include="Meziantou.Analyzer" Version="1.0.606" PrivateAssets="all" />
45+
<PackageReference Include="SecurityCodeScan" Version="3.5.3" PrivateAssets="all" />
4246
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
43-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.17.0.26580" PrivateAssets="All" />
47+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.17.0.26580" PrivateAssets="all" />
4448
</ItemGroup>
4549

46-
</Project>
50+
</Project>

0 commit comments

Comments
 (0)