git-subtree-dir: backend git-subtree-mainline:ab911955edgit-subtree-split:040cfd7a75
83 lines
2.1 KiB
YAML
83 lines
2.1 KiB
YAML
name: Build
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths-ignore:
|
|
- '.scripts/**'
|
|
- .gitignore
|
|
- CODE_OF_CONDUCT.md
|
|
- LICENSE
|
|
- README.md
|
|
|
|
workflow_call:
|
|
inputs:
|
|
build-artifacts:
|
|
type: boolean
|
|
required: true
|
|
default: false
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
name: Checkout code
|
|
|
|
- name: Cache NuGet packages
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.nuget/packages
|
|
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nuget-
|
|
|
|
|
|
- name: Install .NET
|
|
uses: actions/setup-dotnet@v3
|
|
|
|
- name: Restore solution
|
|
run: dotnet restore
|
|
|
|
- name: Build solution
|
|
run: dotnet build --no-restore --configuration Release
|
|
|
|
- name: Test solution
|
|
run: dotnet test --no-build --configuration Release --filter "FullyQualifiedName!~AcceptanceTests"
|
|
|
|
- name: Publish website
|
|
if: ${{ inputs.build-artifacts == true }}
|
|
run: |
|
|
dotnet publish --configuration Release --runtime win-x86 --self-contained --output ./publish
|
|
cd publish
|
|
zip -r ./publish.zip .
|
|
working-directory: ./src/Web/
|
|
|
|
- name: Upload website artifact (website)
|
|
if: ${{ inputs.build-artifacts == true }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: website
|
|
path: ./src/Web/publish/publish.zip
|
|
if-no-files-found: error
|
|
|
|
- name: Create EF Core migrations bundle
|
|
if: ${{ inputs.build-artifacts == true }}
|
|
run: |
|
|
dotnet new tool-manifest
|
|
dotnet tool install dotnet-ef
|
|
dotnet ef migrations bundle --configuration Release -p ./src/Infrastructure/ -s ./src/Web/ -o efbundle.exe
|
|
zip -r ./efbundle.zip efbundle.exe
|
|
env:
|
|
SkipNSwag: True
|
|
|
|
- name: Upload EF Core migrations bundle artifact (efbundle)
|
|
if: ${{ inputs.build-artifacts == true }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: efbundle
|
|
path: ./efbundle.zip
|
|
if-no-files-found: error
|