Skip to content

Build All

Build All #1104

Workflow file for this run

###############################################################################
#
# Copyright 2024 Eppie(https://eppie.io)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################
---
name: "Build solution"
run-name: >-
${{ github.event_name == 'schedule' && 'Build All' || '' }}
${{ github.event_name == 'workflow_dispatch' && format('Build: {0} ({1}) on {2} OS', github.event.inputs.framework, github.event.inputs.configuration, github.event.inputs.os ) || '' }}
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
framework:
type: choice
default: all
options:
- desktop
- wasm
- winui
- ios
- macos
- android
- uwp
- all
os:
type: choice
default: all
options:
- windows
- linux
- macos
- all
configuration:
type: choice
default: release
options:
- debug
- release
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**
schedule:
- cron: '0 0 * * *'
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-config.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Initializing config keywords
shell: bash
run: |
keywords="autobuild"
if [[ ${{ github.event_name }} == 'schedule' ]]; then
keywords="all"
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
keywords="${{ github.event.inputs.framework }},${{ github.event.inputs.os }}"
fi
echo "EPPIE_BUILD_CONFIG_KEYWORDS=$keywords" >> $GITHUB_ENV
- name: Select Build config
id: build-config
uses: finebits/github-actions/toolset/select-configuration@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
json-file: ./.github/configurations/build.json
keywords: ${{ env.EPPIE_BUILD_CONFIG_KEYWORDS }}
- name: Check configs
shell: bash
run: |
length=$( echo '${{ steps.build-config.outputs.config-json }}' | jq '. | length' )
if(( $length == 0 )); then
echo "::error::No suitable build configuration found"
exit 1
fi
build:
name: ${{ matrix.build.framework }} ${{ matrix.os }} '${{ matrix.build.project }}'
needs: prepare
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- name: Initializing configuration
shell: bash
run: |
configuration="${{ matrix.build.configuration }}"
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
configuration="${{ github.event.inputs.configuration }}"
fi
echo "EPPIE_BUILD_CONFIGURATION=$configuration" >> $GITHUB_ENV
- name: Support longpaths
if: ${{ runner.os == 'Windows'}}
run: git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
submodules: recursive
- name: Install Prerequisites
uses: ./.github/actions/install-prerequisites
with:
uno-platform: ${{ matrix.prerequisites.uno-platform == 'true' }}
msbuild: ${{ matrix.prerequisites.msbuild == 'true' }}
- name: Restore via dotnet
if: matrix.restore.tool == 'dotnet'
shell: bash
run: |
project='${{ matrix.restore.project }}'
extra_options='${{ matrix.restore.extra }}'
dotnet restore $extra_options $project
- name: Restore via msbuild
if: matrix.restore.tool == 'msbuild' && runner.os == 'Windows'
shell: pwsh
run: |
$project='${{ matrix.restore.project }}'
$extra_options=$('${{ matrix.restore.extra }}' -split '\s+')
msbuild -target:Restore $extra_options $project
- name: Build via dotnet (${{ env.EPPIE_BUILD_CONFIGURATION }})
if: matrix.build.tool == 'dotnet'
shell: bash
run: |
project='${{ matrix.build.project }}'
configuration='${{ env.EPPIE_BUILD_CONFIGURATION }}'
extra_options='${{ matrix.build.extra }}'
framework='${{ matrix.build.framework }}'
framework_option=$([ "$framework" != "" ] && echo "--framework=$framework" || echo "")
dotnet build --configuration=$configuration $framework_option $extra_options $project
- name: Build via msbuild (${{ env.EPPIE_BUILD_CONFIGURATION }})
if: matrix.build.tool == 'msbuild' && runner.os == 'Windows'
shell: pwsh
run: |
$project='${{ matrix.build.project }}'
$configuration='${{ env.EPPIE_BUILD_CONFIGURATION }}'
$extra_options=$('${{ matrix.build.extra }}' -split '\s+')
$framework='${{ matrix.build.framework }}'
$framework_option=$( if($framework) {"-property:TargetFramework=$framework"} else {""} )
msbuild -target:Build -property:Configuration=$configuration $framework_option $extra_options $project