Optimize GitHub Actions build speed

This commit is contained in:
genteure 2022-06-04 14:16:20 +08:00
parent 9d0df74159
commit dfba519e41
2 changed files with 7 additions and 13 deletions

View File

@ -7,6 +7,7 @@ on:
env: env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
REGISTRY: ghcr.io REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
@ -24,8 +25,6 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-dotnet@v2 - uses: actions/setup-dotnet@v2
- name: Restore Packages
run: dotnet restore -v m --disable-parallel
- name: Run Tests - Debug - name: Run Tests - Debug
run: dotnet test -v m -c Debug run: dotnet test -v m -c Debug
@ -44,12 +43,12 @@ jobs:
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1 uses: microsoft/setup-msbuild@v1.1
- name: Restore Packages - name: Restore Packages
run: nuget restore -Verbosity quiet run: msbuild -t:restore /v:m BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Build WPF - Debug - name: Build WPF - Debug
run: msbuild /nologo /v:m /p:Configuration="Debug" run: msbuild /nologo /v:m /p:Configuration="Debug" BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Build WPF - Release - name: Build WPF - Release
run: msbuild /nologo /v:m /p:Configuration="Release" run: msbuild /nologo /v:m /p:Configuration="Release" BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Upload Artifacts - Debug - name: Upload Artifacts - Debug
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -76,8 +75,6 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-dotnet@v2 - uses: actions/setup-dotnet@v2
- name: Restore Packages
run: dotnet restore -v m --disable-parallel
- name: Build CLI - Debug - name: Build CLI - Debug
if: ${{ matrix.rid == 'any' }} if: ${{ matrix.rid == 'any' }}

View File

@ -7,6 +7,7 @@ on:
env: env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
REGISTRY: ghcr.io REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
@ -23,8 +24,6 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-dotnet@v2 - uses: actions/setup-dotnet@v2
- name: Restore Packages
run: dotnet restore -v m --disable-parallel
- name: Run Tests - Debug - name: Run Tests - Debug
run: dotnet test -v m -c Debug run: dotnet test -v m -c Debug
@ -45,9 +44,9 @@ jobs:
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2 uses: microsoft/setup-msbuild@v1.0.2
- name: Restore Packages - name: Restore Packages
run: nuget restore -Verbosity quiet run: msbuild -t:restore /v:m BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Build WPF - name: Build WPF
run: msbuild /nologo /v:m /p:Configuration="${{ matrix.build_configuration }}" run: msbuild /nologo /v:m /p:Configuration="${{ matrix.build_configuration }}" BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
- name: Upload Build Artifacts - name: Upload Build Artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
@ -85,8 +84,6 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-dotnet@v2 - uses: actions/setup-dotnet@v2
- name: Restore Packages
run: dotnet restore -v m --disable-parallel
- name: Build CLI - name: Build CLI
if: ${{ matrix.rid == 'any' }} if: ${{ matrix.rid == 'any' }}
run: dotnet publish -c ${{ matrix.build_configuration }} BililiveRecorder.Cli/BililiveRecorder.Cli.csproj run: dotnet publish -c ${{ matrix.build_configuration }} BililiveRecorder.Cli/BililiveRecorder.Cli.csproj