66 pull_request :
77 branches : [main]
88
9- env :
10- RUST_TOOLCHAIN : " 1.94.0"
11-
129jobs :
1310 build-test :
1411 name : Build & Test (${{ matrix.os }})
@@ -22,17 +19,17 @@ jobs:
2219 runs-on : ${{ matrix.os }}
2320 steps :
2421 - uses : actions/checkout@v4
22+ with :
23+ # SonarCloud needs the parent branch information.
24+ fetch-depth : 0
2525
2626 - name : Set up .NET
2727 uses : actions/setup-dotnet@v4
2828 with :
2929 global-json-file : global.json
3030
3131 - name : Set up Rust
32- uses : dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
33- with :
34- toolchain : " 1.94.0"
35- targets : wasm32-wasip1
32+ uses : dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1
3633
3734 - name : Cache wasm build
3835 uses : actions/cache@v4
4138 ~/.cargo/registry
4239 ~/.cargo/git
4340 .wasm-build
44- key : wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh') }}
41+ key : wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh', 'rust-toolchain.toml' ) }}
4542
4643 - name : Set up Node.js
4744 uses : actions/setup-node@v4
5653
5754 - name : Build node harness
5855 shell : bash
59- run : npm ci && npm run build
56+ run : npm ci --ignore-scripts && npm rebuild sqlite3 && npm run build
6057 working-directory : tests/node-harness
6158 env :
6259 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6865 run : dotnet build KeetaNet.Anchor.slnx -c Release --no-restore
6966
7067 - name : Test
71- run : dotnet test KeetaNet.Anchor.slnx -c Release --no-build
68+ run : >
69+ dotnet test KeetaNet.Anchor.slnx -c Release --no-build
70+ -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml
71+
72+ # Run SonarCloud on the coverage this test run
73+ - name : Convert coverage to SonarQube format
74+ if : matrix.os == 'ubuntu-latest-l' && github.repository == 'KeetaNetwork/anchor-csharp'
75+ run : |
76+ dotnet tool install --global dotnet-reportgenerator-globaltool
77+ reportgenerator \
78+ "-reports:**/TestResults/**/coverage.cobertura.xml" \
79+ "-targetdir:.sonar-coverage" \
80+ "-reporttypes:SonarQube"
81+
82+ - name : SonarCloud Scan
83+ if : matrix.os == 'ubuntu-latest-l' && github.repository == 'KeetaNetwork/anchor-csharp'
84+ uses : SonarSource/sonarqube-scan-action@689fb39b34b9aa95ebc5f8f119343ddd51542402 # v4.2.2
85+ env :
86+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
87+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
88+ with :
89+ args : >
90+ -Dproject.settings=./sonar-project.properties
7291
7392 lint :
7493 name : Lint
92111 scope : " @keetanetwork"
93112
94113 - name : Check formatting and linting
95- run : make lint
114+ run : make do- lint-ci
96115 env :
97116 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98117
@@ -108,10 +127,7 @@ jobs:
108127 global-json-file : global.json
109128
110129 - name : Set up Rust
111- uses : dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
112- with :
113- toolchain : " 1.94.0"
114- targets : wasm32-wasip1
130+ uses : dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1
115131
116132 - name : Cache wasm build
117133 uses : actions/cache@v4
@@ -120,13 +136,13 @@ jobs:
120136 ~/.cargo/registry
121137 ~/.cargo/git
122138 .wasm-build
123- key : wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh') }}
139+ key : wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh', 'rust-toolchain.toml' ) }}
124140
125141 - name : Build wasm core
126142 run : bash scripts/build-wasm.sh
127143
128144 - name : Pack
129- run : dotnet pack src/ KeetaNet.Anchor/KeetaNet.Anchor.csproj -c Release -o artifacts
145+ run : dotnet pack KeetaNet.Anchor.slnx -c Release -o artifacts
130146
131147 - name : Upload package
132148 uses : actions/upload-artifact@v4
@@ -155,57 +171,3 @@ jobs:
155171 echo "::error::Vulnerable packages found"
156172 exit 1
157173 fi
158-
159- sonar :
160- name : SonarCloud
161- runs-on : ubuntu-latest-l
162- if : github.repository == 'KeetaNetwork/anchor-csharp'
163- steps :
164- - uses : actions/checkout@v4
165- with :
166- fetch-depth : 0
167-
168- - name : Set up .NET
169- uses : actions/setup-dotnet@v4
170- with :
171- global-json-file : global.json
172-
173- - name : Set up Rust
174- uses : dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
175- with :
176- toolchain : " 1.94.0"
177- targets : wasm32-wasip1
178-
179- - name : Cache wasm build
180- uses : actions/cache@v4
181- with :
182- path : |
183- ~/.cargo/registry
184- ~/.cargo/git
185- .wasm-build
186- key : wasm-${{ runner.os }}-${{ hashFiles('scripts/build-wasm.sh') }}
187-
188- - name : Build wasm core
189- run : bash scripts/build-wasm.sh
190-
191- - name : Test with coverage
192- run : >
193- dotnet test tests/KeetaNet.Anchor.Tests/KeetaNet.Anchor.Tests.csproj -c Release
194- -- --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml
195-
196- - name : Convert coverage to SonarQube format
197- run : |
198- dotnet tool install --global dotnet-reportgenerator-globaltool
199- reportgenerator \
200- "-reports:**/TestResults/**/coverage.cobertura.xml" \
201- "-targetdir:.sonar-coverage" \
202- "-reporttypes:SonarQube"
203-
204- - name : SonarCloud Scan
205- uses : SonarSource/sonarqube-scan-action@689fb39b34b9aa95ebc5f8f119343ddd51542402 # v4.2.2
206- env :
207- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
208- SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
209- with :
210- args : >
211- -Dproject.settings=./sonar-project.properties
0 commit comments