|
1 | 1 | name: Build .NET |
2 | 2 | on: |
3 | | - workflow_call: |
4 | | - inputs: |
5 | | - os_matrix: |
6 | | - description: 'A JSON string array of OS matrix to build against' |
7 | | - default: "[\"macos-latest\", \"ubuntu-latest\", \"windows-latest\"]" |
8 | | - required: false |
9 | | - type: string |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + os_matrix: |
| 6 | + description: "A JSON string array of OS matrix to build against" |
| 7 | + default: '["macos-latest", "ubuntu-latest", "windows-latest"]' |
| 8 | + required: false |
| 9 | + type: string |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - build: |
13 | | - runs-on: ${{ matrix.os }} |
14 | | - strategy: |
15 | | - fail-fast: false |
16 | | - matrix: |
17 | | - os: ${{fromJson(inputs.os_matrix)}} |
18 | | - env: |
19 | | - # https://www.donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds |
20 | | - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: '1' |
21 | | - DOTNET_NOLOGO: '1' |
22 | | - DOTNET_CLI_TELEMETRY_OPTOUT: '1' |
23 | | - # See more here: https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/default-probing#how-do-i-debug-the-probing-properties-construction. |
24 | | - COREHOST_TRACE: '0' |
25 | | - # See more here: https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-environment-variables. |
26 | | - NUGET_XMLDOC_MODE: 'skip' |
27 | | - DOTNET_MULTILEVEL_LOOKUP: 0 |
28 | | - CI_BUILD: 'true' |
29 | | - steps: |
30 | | - - uses: actions/checkout@v2 |
31 | | - with: |
32 | | - fetch-depth: 0 |
33 | | - - name: Install .NET |
34 | | - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' |
35 | | - run: | |
36 | | - ./eng/install-sdk.sh |
37 | | - echo "DOTNET_ROOT=$GITHUB_WORKSPACE/eng/.dotnet" >> $GITHUB_ENV |
38 | | - echo "$GITHUB_WORKSPACE/eng/.dotnet" >> $GITHUB_PATH |
| 12 | + build: |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + os: ${{fromJson(inputs.os_matrix)}} |
| 18 | + env: |
| 19 | + # https://www.donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds |
| 20 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1" |
| 21 | + DOTNET_NOLOGO: "1" |
| 22 | + DOTNET_CLI_TELEMETRY_OPTOUT: "1" |
| 23 | + # See more here: https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/default-probing#how-do-i-debug-the-probing-properties-construction. |
| 24 | + COREHOST_TRACE: "0" |
| 25 | + # See more here: https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-environment-variables. |
| 26 | + NUGET_XMLDOC_MODE: "skip" |
| 27 | + DOTNET_MULTILEVEL_LOOKUP: 0 |
| 28 | + CI_BUILD: "true" |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v2 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + - name: Install .NET |
| 34 | + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' |
| 35 | + run: | |
| 36 | + ./eng/install-sdk.sh |
| 37 | + echo "DOTNET_ROOT=$GITHUB_WORKSPACE/eng/.dotnet" >> $GITHUB_ENV |
| 38 | + echo "$GITHUB_WORKSPACE/eng/.dotnet" >> $GITHUB_PATH |
39 | 39 |
|
40 | | - - name: Install .NET |
41 | | - if: matrix.os == 'windows-latest' |
42 | | - run: | |
43 | | - ./eng/install-sdk.ps1 |
44 | | - echo "DOTNET_ROOT=$Env:GITHUB_WORKSPACE/eng/.dotnet" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append |
45 | | - echo "$Env:GITHUB_WORKSPACE/eng/.dotnet" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf-8 -Append |
| 40 | + - name: Install .NET |
| 41 | + if: matrix.os == 'windows-latest' |
| 42 | + run: | |
| 43 | + ./eng/install-sdk.ps1 |
| 44 | + echo "DOTNET_ROOT=$Env:GITHUB_WORKSPACE/eng/.dotnet" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append |
| 45 | + echo "$Env:GITHUB_WORKSPACE/eng/.dotnet" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf-8 -Append |
46 | 46 |
|
47 | | - - name: Print host info |
48 | | - run: printenv && dotnet --info |
| 47 | + - name: Print host info |
| 48 | + run: printenv && dotnet --info |
49 | 49 |
|
50 | | - - name: Restore dependencies |
51 | | - run: dotnet restore |
| 50 | + - name: Restore dependencies |
| 51 | + run: dotnet restore |
52 | 52 |
|
53 | | - - name: Build |
54 | | - run: dotnet build --no-restore --no-incremental /WarnAsError |
| 53 | + - name: Build |
| 54 | + run: dotnet build --no-restore --no-incremental /WarnAsError |
55 | 55 |
|
56 | | - - name: Test |
57 | | - run: dotnet test --no-build |
| 56 | + - name: Test |
| 57 | + run: dotnet test --no-build |
58 | 58 |
|
59 | | - - name: Run Tool PowerShell |
60 | | - if: matrix.os == 'windows-latest' |
61 | | - shell: pwsh |
62 | | - run: ./src/dotnet-affected/bin/Debug/net6.0/dotnet-affected -p $Env:GITHUB_WORKSPACE --assume-changes dotnet-affected -v |
| 59 | + - name: Run Tool PowerShell |
| 60 | + if: matrix.os == 'windows-latest' |
| 61 | + shell: pwsh |
| 62 | + run: ./src/dotnet-affected/bin/Debug/net9.0/dotnet-affected -p $Env:GITHUB_WORKSPACE --assume-changes dotnet-affected -v |
63 | 63 |
|
64 | | - - name: Run Tool Bash |
65 | | - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' |
66 | | - shell: bash |
67 | | - run: ./src/dotnet-affected/bin/Debug/net6.0/dotnet-affected -p $GITHUB_WORKSPACE --assume-changes dotnet-affected -v |
| 64 | + - name: Run Tool Bash |
| 65 | + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' |
| 66 | + shell: bash |
| 67 | + run: ./src/dotnet-affected/bin/Debug/net9.0/dotnet-affected -p $GITHUB_WORKSPACE --assume-changes dotnet-affected -v |
68 | 68 |
|
69 | | - - name: Pack |
70 | | - if: success() && matrix.os == 'ubuntu-latest' |
71 | | - run: dotnet pack --no-restore --no-build --configuration Debug --include-symbols -p:SymbolPackageFormat=snupkg -o $GITHUB_WORKSPACE/packages |
| 69 | + - name: Pack |
| 70 | + if: success() && matrix.os == 'ubuntu-latest' |
| 71 | + run: dotnet pack --no-restore --no-build --configuration Debug --include-symbols -p:SymbolPackageFormat=snupkg -o $GITHUB_WORKSPACE/packages |
72 | 72 |
|
73 | | - - uses: actions/upload-artifact@v3 |
74 | | - name: 'Upload Packages' |
75 | | - if: success() && matrix.os == 'ubuntu-latest' |
76 | | - with: |
77 | | - name: packages |
78 | | - path: ${{ github.workspace }}/packages/**/* |
| 73 | + - uses: actions/upload-artifact@v3 |
| 74 | + name: "Upload Packages" |
| 75 | + if: success() && matrix.os == 'ubuntu-latest' |
| 76 | + with: |
| 77 | + name: packages |
| 78 | + path: ${{ github.workspace }}/packages/**/* |
79 | 79 |
|
80 | | - - uses: actions/upload-artifact@v3 |
81 | | - name: 'Upload Artifacts' |
82 | | - if: success() && matrix.os == 'ubuntu-latest' |
83 | | - with: |
84 | | - name: artifacts |
85 | | - path: src/dotnet-affected/bin/Debug/net8.0/ |
| 80 | + - uses: actions/upload-artifact@v3 |
| 81 | + name: "Upload Artifacts" |
| 82 | + if: success() && matrix.os == 'ubuntu-latest' |
| 83 | + with: |
| 84 | + name: artifacts |
| 85 | + path: src/dotnet-affected/bin/Debug/net9.0/ |
0 commit comments