mirror of
https://github.com/ModOrganizer2/build-with-mob-action.git
synced 2026-07-27 14:08:35 -07:00
151 lines
5.2 KiB
YAML
151 lines
5.2 KiB
YAML
name: Build with mob
|
|
description: Build ModOrganizer 2 plugins and executables using mob
|
|
|
|
inputs:
|
|
mo2-owner:
|
|
description: Owner to use to build.
|
|
required: false
|
|
default: ${{ github.event.pull_request.head.repo.owner.login }}
|
|
mo2-branch:
|
|
description: Branch to build.
|
|
required: false
|
|
default: ${{ github.head_ref || github.ref_name }}
|
|
mo2-third-parties:
|
|
description: List of third-party dependencies to build (including USVFS).
|
|
required: false
|
|
default: ""
|
|
mo2-dependencies:
|
|
description: List of MO2 dependencies to build.
|
|
required: false
|
|
default: ""
|
|
mo2-cmake-command:
|
|
description: MO2 CMake command to run.
|
|
required: false
|
|
default: ".."
|
|
qt-install:
|
|
description: Whether to install Qt or not.
|
|
required: false
|
|
default: "true"
|
|
# TODO: extract this from mob
|
|
qt-version:
|
|
description: Override Qt version to install.
|
|
required: false
|
|
default: ""
|
|
qt-modules:
|
|
description: List of Qt modules to install.
|
|
required: false
|
|
default: ""
|
|
|
|
outputs:
|
|
working-directory:
|
|
description: Working directory containing the vsbuild folder.
|
|
value: ./build/modorganizer_super/${{ github.event.repository.name }}
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
# mob
|
|
- name: Determine mob branch
|
|
id: determine-mob-branch
|
|
shell: bash
|
|
run: |
|
|
branch=master
|
|
if git ls-remote --exit-code https://github.com/ModOrganizer2/mob.git ${{ inputs.mo2-branch }} > /dev/null 2>&1; then
|
|
branch=${{ inputs.mo2-branch }}
|
|
fi
|
|
echo "branch=${branch}" >> "$GITHUB_OUTPUT"
|
|
- name: Checkout mob
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: modorganizer2/mob
|
|
ref: ${{ steps.determine-mob-branch.outputs.branch }}
|
|
path: ./mob
|
|
- name: Cache mob
|
|
id: cache-mob
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./mob/mob.exe
|
|
key: ${{ runner.OS }}-mob-cache-${{ hashFiles(format('{0}/{1}', './mob/.git/refs/heads/', steps.determine-mob-branch.outputs.branch)) }}
|
|
restore-keys: |
|
|
${{ runner.OS }}-mob-cache-
|
|
- if: ${{ steps.cache-mob.outputs.cache-hit != 'true' }}
|
|
name: Build mob
|
|
shell: pwsh
|
|
run: .\mob\bootstrap.ps1
|
|
- name: Add mob to PATH
|
|
shell: pwsh
|
|
run: echo "${{ github.workspace }}/mob" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
# Qt
|
|
- name: Get Qt version
|
|
id: find-qt-version
|
|
shell: pwsh
|
|
run: |
|
|
$version = "${{ inputs.qt-version }}"
|
|
if (!$version) {
|
|
$version = (Get-Content "${{ github.workspace }}\mob\mob.ini" | Select-String -Raw "^qt\s+=").Split("= ")[1]
|
|
}
|
|
Write-Output "Found Qt Version: $version"
|
|
Write-Output "QT_VERSION=$version" >> "$env:GITHUB_OUTPUT"
|
|
- if: inputs.qt-install == 'true'
|
|
name: Install Qt
|
|
uses: jurplel/install-qt-action@v3
|
|
with:
|
|
version: ${{ steps.find-qt-version.outputs.QT_VERSION }}
|
|
modules: ${{ inputs.qt-modules }}
|
|
cache: true
|
|
- name: Add Qt bins to PATH
|
|
shell: pwsh
|
|
run: echo "${QT_ROOT_DIR }/msvc2019_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
# Third-Party dependencies
|
|
- name: Cache third-party dependencies
|
|
id: cache-dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./build
|
|
!./build/modorganizer_super
|
|
key: ${{ runner.OS }}-mob-dependencies-${{ hashFiles(format('{0}/{1}', './mob/.git/refs/heads/', steps.determine-mob-branch.outputs.branch)) }}
|
|
restore-keys: |
|
|
${{ runner.OS }}-mo2-dependencies-
|
|
- if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.10"
|
|
- if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }}
|
|
id: build-third-party-deps
|
|
shell: pwsh
|
|
run: |
|
|
pip install PyYAML
|
|
$third_parties = (python ${env:GITHUB_ACTION_PATH}/make-dependencies.py ${{ inputs.mo2-dependencies }})
|
|
Write-Output "Found third parties dependencies: ${third_parties}"
|
|
Write-Output "MO2_THIRD_PARTIES=${third_parties}" >> "$env:GITHUB_OUTPUT"
|
|
- if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }}
|
|
shell: pwsh
|
|
name: Build dependencies with mob
|
|
run: mob.exe -l 4 -d . build ${{ steps.build-third-party-deps.outputs.MO2_THIRD_PARTIES }} ${{ inputs.mo2-third-parties }}
|
|
- name: Build dependencies log
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-dependencies-log
|
|
path: |
|
|
mob.log
|
|
|
|
# MO2 dependencies
|
|
- name: Build MO2 modules
|
|
shell: pwsh
|
|
run: '& ${env:GITHUB_ACTION_PATH}/build-mo2-dependencies.ps1 -Owner ${{ inputs.mo2-owner }} -Branch ${{ inputs.mo2-branch }} "${{ inputs.mo2-dependencies }}"'
|
|
|
|
# build repository
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
path: ./build/modorganizer_super/${{ github.event.repository.name }}
|
|
- name: Build Plugin Python
|
|
shell: pwsh
|
|
run: |
|
|
mob -l 4 cmake -c "${{ inputs.mo2-cmake-command }}" vsbuild
|
|
cmake --build vsbuild --config RelWithDebInfo -j4
|
|
working-directory: ./build/modorganizer_super/${{ github.event.repository.name }}
|