Skip to content

Commit cea90c7

Browse files
committed
ci: migrate to nuke (#21)
* ci: migrate to nuke * deps: update nuget packages * chore: editorconfig fix
1 parent 507bdcd commit cea90c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+684
-219
lines changed

.config/dotnet-tools.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@
88
"dotnet-outdated"
99
]
1010
},
11-
"dotnet-sonarscanner": {
12-
"version": "6.2.0",
13-
"commands": [
14-
"dotnet-sonarscanner"
15-
]
16-
},
17-
"dotnet-format": {
18-
"version": "5.1.250801",
19-
"commands": [
20-
"dotnet-format"
21-
]
22-
},
2311
"roslynator.dotnet.cli": {
2412
"version": "0.8.3",
2513
"commands": [

.editorconfig

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ tab_width = 4
1919

2020
# New line preferences
2121
end_of_line = crlf
22-
insert_final_newline = false
22+
insert_final_newline = true
2323

2424
#### .NET Coding Conventions ####
2525
[*.{cs,vb}]
2626

2727
# Organize usings
28-
dotnet_separate_import_directive_groups = true
29-
dotnet_sort_system_directives_first = true
28+
dotnet_separate_import_directive_groups = false
29+
dotnet_sort_system_directives_first = false
3030
file_header_template = unset
3131

3232
# this. and Me. preferences
@@ -46,7 +46,7 @@ dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
4646
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
4747

4848
# Modifier preferences
49-
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
49+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
5050

5151
# Expression-level preferences
5252
dotnet_style_coalesce_expression = true:suggestion
@@ -78,9 +78,9 @@ dotnet_remove_unnecessary_suppression_exclusions = none
7878
[*.cs]
7979

8080
# var preferences
81-
csharp_style_var_elsewhere = false:silent
82-
csharp_style_var_for_built_in_types = false:silent
83-
csharp_style_var_when_type_is_apparent = false:silent
81+
csharp_style_var_elsewhere = true:silent
82+
csharp_style_var_for_built_in_types = true:silent
83+
csharp_style_var_when_type_is_apparent = true:silent
8484

8585
# Expression-bodied members
8686
csharp_style_expression_bodied_accessors = true:silent
@@ -96,7 +96,7 @@ csharp_style_expression_bodied_properties = true:silent
9696
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
9797
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
9898
csharp_style_prefer_not_pattern = true:suggestion
99-
csharp_style_prefer_pattern_matching = true:silent
99+
csharp_style_prefer_pattern_matching = true:suggestion
100100
csharp_style_prefer_switch_expression = true:suggestion
101101

102102
# Null-checking preferences
@@ -108,7 +108,7 @@ csharp_preferred_modifier_order = public,private,protected,internal,static,exter
108108

109109
# Code-block preferences
110110
csharp_prefer_braces = true:silent
111-
csharp_prefer_simple_using_statement = true:suggestion
111+
csharp_prefer_simple_using_statement = true:warning
112112

113113
# Expression-level preferences
114114
csharp_prefer_simple_default_expression = true:suggestion
@@ -124,6 +124,9 @@ csharp_style_unused_value_expression_statement_preference = discard_variable:sil
124124
# 'using' directive preferences
125125
csharp_using_directive_placement = outside_namespace:silent
126126

127+
csharp_style_prefer_primary_constructors = true:suggestion
128+
csharp_style_expression_bodied_methods = true:suggestion
129+
127130
#### C# Formatting Rules ####
128131

129132
# New line preferences
@@ -169,7 +172,7 @@ csharp_space_between_square_brackets = false
169172

170173
# Wrapping preferences
171174
csharp_preserve_single_line_blocks = true
172-
csharp_preserve_single_line_statements = true
175+
csharp_preserve_single_line_statements = false
173176

174177
#### Naming styles ####
175178
[*.{cs,vb}]
@@ -362,3 +365,10 @@ dotnet_naming_style.s_camelcase.required_suffix =
362365
dotnet_naming_style.s_camelcase.word_separator =
363366
dotnet_naming_style.s_camelcase.capitalization = camel_case
364367

368+
# More rules
369+
dotnet_diagnostic.IDE0005.severity = error
370+
dotnet_diagnostic.IDE0035.severity = error
371+
dotnet_style_prefer_collection_expression = true
372+
373+
[*.cs]
374+
csharp_style_namespace_declarations = file_scoped:error

.gitattributes

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
* text eol=crlf
2-
*.png -text
1+
* text=auto eol=crlf
2+
*.cs text eol=crlf
3+
*.png -text
4+
build.sh text eol=lf
5+
build.cmd text eol=lf

.github/workflows/deployment.yaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ on:
77

88
jobs:
99
deployment:
10-
uses: ArwynFr/ArwynFr/.github/workflows/deployment-nuget.yaml@main
11-
with:
12-
target: .
13-
secrets:
14-
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout sources
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install Java 21 Temurin
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: "temurin"
21+
java-version: "21"
22+
23+
- name: Publish using nuke
24+
run: ./build.cmd Clean Publish
25+
env:
26+
GH_TOKEN: ${{ github.token }}
27+
SONAR_TOKEN: ${{ secrets.sonar_token }}
28+
NUGET_APIKEY: ${{ secrets.nuget_apikey }}

.github/workflows/integration.yaml

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,27 @@ on:
44
workflow_dispatch:
55
pull_request:
66
branches: [main]
7-
push:
8-
branches: [main]
97

108
concurrency:
119
group: ${{ github.workflow }}-${{ github.ref }}
1210
cancel-in-progress: true
1311

1412
jobs:
15-
sonarqube:
13+
integration:
1614
runs-on: ubuntu-latest
1715
steps:
1816
- name: Checkout sources
1917
uses: actions/checkout@v4
20-
- name: Use Java 21 Temuerin
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install Java 21 Temurin
2122
uses: actions/setup-java@v4
2223
with:
2324
distribution: "temurin"
2425
java-version: "21"
25-
- name: Restore dotnet tools
26-
run: dotnet tool restore
27-
- name: SonarCloud configuration
28-
run: >
29-
dotnet sonarscanner begin
30-
/o:arwynfr
31-
/key:ArwynFr_dotnet-integration-testing
32-
/d:sonar.host.url=https://sonarcloud.io
33-
/d:sonar.cs.opencover.reportsPaths=TestResults/*/coverage.opencover.xml
34-
/d:sonar.verbose=true
35-
env:
36-
SONAR_TOKEN: ${{ secrets.sonar_token }}
37-
- name: Run automated tests
38-
run: dotnet test test/ArwynFr.IntegrationTesting.Tests --settings .runsettings --results-directory TestResults
39-
- name: SonarCloud analyze
40-
run: dotnet sonarscanner end
26+
27+
- name: Verify using nuke
28+
run: ./build.sh Clean Verify
4129
env:
4230
SONAR_TOKEN: ${{ secrets.sonar_token }}
43-
44-
code-lint:
45-
runs-on: ubuntu-latest
46-
steps:
47-
- name: Checkout sources
48-
uses: actions/checkout@v4
49-
- name: Restore dotnet tools
50-
run: dotnet tool restore
51-
- name: Check dotnet-format
52-
run: dotnet format --verify-no-changes
53-
- name: Check roslynator
54-
run: dotnet roslynator analyze
55-
56-
docs-lint:
57-
runs-on: ubuntu-latest
58-
steps:
59-
- name: Checkout sources
60-
uses: actions/checkout@v4
61-
- name: Check markdown
62-
uses: nosborn/[email protected]
63-
with:
64-
files: .
65-
dot: true
66-
config_file: .markdownlint
67-
68-
not-outdated:
69-
runs-on: ubuntu-latest
70-
steps:
71-
- name: Checkout sources
72-
uses: actions/checkout@v4
73-
- name: Restore dotnet tools
74-
run: dotnet tool restore
75-
- name: Check outdated nuget packages
76-
run: dotnet outdated --fail-on-updates

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,4 +485,7 @@ $RECYCLE.BIN/
485485
*.swp
486486

487487
# Sonarqube
488-
.sonarqube
488+
.sonarqube
489+
490+
# Nuke temp directory
491+
.nuke/temp

.nuke/build.schema.json

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"$ref": "#/definitions/build",
4+
"title": "Build Schema",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Continue": {
10+
"type": "boolean",
11+
"description": "Indicates to continue a previously failed build attempt"
12+
},
13+
"GhToken": {
14+
"type": "string",
15+
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
16+
},
17+
"Help": {
18+
"type": "boolean",
19+
"description": "Shows the help text for this build assembly"
20+
},
21+
"Host": {
22+
"type": "string",
23+
"description": "Host for execution. Default is 'automatic'",
24+
"enum": [
25+
"AppVeyor",
26+
"AzurePipelines",
27+
"Bamboo",
28+
"Bitbucket",
29+
"Bitrise",
30+
"GitHubActions",
31+
"GitLab",
32+
"Jenkins",
33+
"Rider",
34+
"SpaceAutomation",
35+
"TeamCity",
36+
"Terminal",
37+
"TravisCI",
38+
"VisualStudio",
39+
"VSCode"
40+
]
41+
},
42+
"NoLogo": {
43+
"type": "boolean",
44+
"description": "Disables displaying the NUKE logo"
45+
},
46+
"NugetApikey": {
47+
"type": "string",
48+
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
49+
},
50+
"Partition": {
51+
"type": "string",
52+
"description": "Partition to use on CI"
53+
},
54+
"Plan": {
55+
"type": "boolean",
56+
"description": "Shows the execution plan (HTML)"
57+
},
58+
"Profile": {
59+
"type": "array",
60+
"description": "Defines the profiles to load",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"Root": {
66+
"type": "string",
67+
"description": "Root directory during build execution"
68+
},
69+
"Skip": {
70+
"type": "array",
71+
"description": "List of targets to be skipped. Empty list skips all dependencies",
72+
"items": {
73+
"type": "string",
74+
"enum": [
75+
"Clean",
76+
"Fix",
77+
"Pack",
78+
"Publish",
79+
"Release",
80+
"RestoreTools",
81+
"Tags",
82+
"Verify",
83+
"VerifyFormat",
84+
"Verifying",
85+
"VerifyOutdated",
86+
"VerifyRoslyn",
87+
"VerifySonarqube"
88+
]
89+
}
90+
},
91+
"Solution": {
92+
"type": "string",
93+
"description": "Path to a solution file that is automatically loaded"
94+
},
95+
"SonarToken": {
96+
"type": "string",
97+
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
98+
},
99+
"Target": {
100+
"type": "array",
101+
"description": "List of targets to be invoked. Default is '{default_target}'",
102+
"items": {
103+
"type": "string",
104+
"enum": [
105+
"Clean",
106+
"Fix",
107+
"Pack",
108+
"Publish",
109+
"Release",
110+
"RestoreTools",
111+
"Tags",
112+
"Verify",
113+
"VerifyFormat",
114+
"Verifying",
115+
"VerifyOutdated",
116+
"VerifyRoslyn",
117+
"VerifySonarqube"
118+
]
119+
}
120+
},
121+
"Verbosity": {
122+
"type": "string",
123+
"description": "Logging verbosity during build execution. Default is 'Normal'",
124+
"enum": [
125+
"Minimal",
126+
"Normal",
127+
"Quiet",
128+
"Verbose"
129+
]
130+
}
131+
}
132+
}
133+
}
134+
}

.nuke/parameters.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"Solution": "dotnet-integration-testing.sln"
4+
}

build.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:; set -eo pipefail
2+
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3+
:; ${SCRIPT_DIR}/build.sh "$@"
4+
:; exit $?
5+
6+
@ECHO OFF
7+
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*

0 commit comments

Comments
 (0)