Skip to content

Commit be9d813

Browse files
committed
* remove run: dotnet new globaljson in favor of changing the hardcoded input dotnet-version of actions/setup-dotnet@v4 to global-json-file
* add `--locked-mode` param for run `dotnet restore` @ actions/c#/action.yml + env `NUGET_PACKAGES` to use runner-level preinstalled NuGet packages + run ReSharper cli over the whole solution via `muno92/resharper_inspectcode@v1` @ workflows/c#.yml @ .github $ dotnet new globaljson --sdk-version 8.0.0 # then set `rollForward: latestFeature` @ c#
1 parent fcd4971 commit be9d813

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

.github/actions/c#/action.yml

+11-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ runs:
88
submodules: true
99
- uses: actions/setup-dotnet@v4
1010
with: # https://github.com/actions/setup-dotnet/tree/v4
11-
dotnet-version: 7
11+
global-json-file: c#/global.json
1212
# cache: true
1313
# # https://github.com/actions/setup-node/issues/624#issuecomment-1328681525
1414
# cache-dependency-path: ${{ github.workspace }}/c#/*/packages.lock.json
@@ -18,14 +18,15 @@ runs:
1818
- id: cache-restore
1919
uses: actions/cache/restore@v4
2020
with:
21-
path: ~/.nuget/packages
22-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
21+
path:
22+
- ${{ github.workspace }}/.nuget/packages
23+
- ${{ github.workspace }}/.resharper
24+
key: |
25+
${{ runner.os }}-nuget-
26+
${{ hashFiles('c#/*/packages.lock.json') }}-
2327
restore-keys: ${{ runner.os }}-nuget-
2428

25-
- run: dotnet new globaljson --sdk-version 7.0.405
26-
working-directory: c#
27-
shell: bash
28-
- run: dotnet restore
29+
- run: dotnet restore --locked-mode
2930
working-directory: c#
3031
shell: bash
3132

@@ -34,5 +35,7 @@ runs:
3435
- uses: actions/cache/save@v4
3536
if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }}
3637
with:
37-
path: ~/.nuget/packages
38+
path:
39+
- ${{ github.workspace }}/.nuget/packages
40+
- ${{ github.workspace }}/.resharper
3841
key: ${{ steps.cache-restore.outputs.cache-primary-key }}

.github/workflows/c#.yml

+15
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,22 @@ jobs:
1111
strategy:
1212
matrix:
1313
project: [crawler, imagePipeline, shared, tbClient]
14+
env:
15+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
1416
steps:
1517
- uses: actions/checkout@v4
1618
- uses: ./.github/actions/c#
1719
- run: dotnet build --no-restore -c Debug ${{ matrix.project }}
20+
21+
ReSharper:
22+
runs-on: ubuntu-latest
23+
env:
24+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: ./.github/actions/c#
28+
- uses: muno92/resharper_inspectcode@v1
29+
with:
30+
solutionPath: c#/tbm.sln
31+
workingDirectory: c#
32+
cacheHome: ${{ github.workspace }}/.resharper

c#/global.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "8.0.0",
4+
"rollForward": "latestFeature" // https://github.com/actions/setup-dotnet/pull/481
5+
}
6+
}

0 commit comments

Comments
 (0)