Update dotnet.yml #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Build Workflow | |
on: | |
push: | |
branches: [ "dev", "master" ] | |
pull_request: | |
branches: [ "dev", "master" ] | |
workflow_dispatch: | |
inputs: | |
include_windows: | |
description: "Include windows" | |
default: true | |
type: boolean | |
jobs: | |
build-linux: | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup Workload | |
run: dotnet workload restore | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Publish for Linux | |
run: | | |
mkdir pub | |
dotnet publish -c Release -r linux-x64 InfrastSimExports | |
cp InfrastSimExports/bin/Release/net8.0/linux-x64/publish/InfrastSimExports.* pub/ | |
- name: Upload Clib | |
uses: actions/upload-artifact@v3 | |
with: | |
name: InfrastSim-clib-linux | |
path: pub/* | |
- name: Upload Wasm AppBundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: AppBundle | |
path: InfrastSimWasm/bin/Release/net8.0/browser-wasm/AppBundle/ | |
build-windows: | |
strategy: | |
fail-fast: false | |
runs-on: windows-latest | |
# 只有当当前分支与 matrix 中的 branch 匹配时才运行 job | |
if: contains('master', github.ref_name) || inputs.include_windows | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup Workload | |
run: dotnet workload restore | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
- name: Publish for Windows | |
run: | | |
mkdir pub | |
dotnet publish -c Release -r win-x64 InfrastSimExports | |
cp InfrastSimExports/bin/Release/net8.0/win-x64/publish/InfrastSimExports.* pub/ | |
- name: Upload Clib | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: InfrastSim-clib-win | |
path: pub/* |