-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yml
More file actions
160 lines (149 loc) · 6.31 KB
/
action.yml
File metadata and controls
160 lines (149 loc) · 6.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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 || github.repository_owner }}
mo2-branch:
description: Branch to build.
required: false
default: ${{ github.head_ref || github.ref_name }}
mo2-dependencies:
description: List of MO2 dependencies to build.
required: false
default: ""
mo2-skip-checkout:
description: Whether to skip checkout of the repository.
required: false
default: "false"
mo2-skip-configure:
description: Whether to skip configure of the repository.
required: false
default: "false"
mo2-skip-build:
description: Whether to skip build of the repository (after configure).
required: false
default: "false"
qt-install:
description: Whether to install Qt or not.
required: false
default: "true"
qt-modules:
description: List of Qt modules to install.
required: false
default: ""
outputs:
cmake-prefix-path:
description: Value of the CMAKE_PREFIX_PATH variable used when configuring.
value: ${{ steps.set-cmake-paths.outputs.cmake-prefix-path }}
cmake-install-path:
description: Value of the CMAKE_INSTALL_PREFIX variable used when configuring.
value: ${{ steps.set-cmake-paths.outputs.cmake-install-path }}
working-directory:
description: Working directory containing the vsbuild folder.
value: ./build/${{ github.event.repository.name }}
runs:
using: "composite"
steps:
# Qt version
- 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.ini
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/ModOrganizer2/mob/refs/heads/${{ steps.determine-mob-branch.outputs.branch }}/mob.ini" -OutFile ${{ github.workspace }}/mob.ini
# Qt
- name: Get Qt version
id: find-qt-version
shell: pwsh
run: |
$version = "${{ inputs.qt-version }}"
if (!$version) {
$version = (Get-Content "${{ github.workspace }}/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@v4
with:
version: ${{ steps.find-qt-version.outputs.QT_VERSION }}
modules: ${{ inputs.qt-modules }}
arch: win64_msvc2022_64
aqtsource: git+https://github.com/miurahr/aqtinstall.git
cache: true
- name: Add Qt bins to PATH
shell: pwsh
run: echo "${QT_ROOT_DIR}/msvc2022_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# set VCPKG Root
- name: "Set environmental variables"
shell: bash
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
# set CMake install and prefix
- name: "Set CMAKE_PREFIX_PATH and CMAKE_INSTALL_PATH"
id: set-cmake-paths
shell: bash
run: |
echo "cmake-prefix-path=${QT_ROOT_DIR}\msvc2022_64;${{ github.workspace }}\build\cmake_common;${{ github.workspace }}\install\lib\cmake" >> $GITHUB_OUTPUT
echo "cmake-install-path=${{ github.workspace }}\install" >> $GITHUB_OUTPUT
# MO2 dependencies
- name: Checkout MO2 modules
shell: pwsh
run: '& ${env:GITHUB_ACTION_PATH}/checkout-mo2-dependencies.ps1 -Owner ${{ inputs.mo2-owner }} -Branch ${{ inputs.mo2-branch }} "cmake_common ${{ inputs.mo2-dependencies }}"'
- name: Configure & Build MO2 dependencies
shell: pwsh
run: |
Get-ChildItem build -Directory -Exclude ".git", "cmake_common", "${{ github.event.repository.name }}" | ForEach-Object {
Write-Output "Building $_... "
Push-Location $_
if ($_.Name -eq "usvfs") {
cmake --preset vs2022-windows-x64 `
"-DCMAKE_PREFIX_PATH=${{ steps.set-cmake-paths.outputs.cmake-prefix-path }}" `
"-DCMAKE_INSTALL_PREFIX=${{ steps.set-cmake-paths.outputs.cmake-install-path }}" `
"-DBUILD_TESTING=OFF"
cmake --build --preset vs2022-windows-x64 --config RelWithDebInfo --target INSTALL --parallel 16
cmake --preset vs2022-windows-x86 `
"-DCMAKE_PREFIX_PATH=${{ steps.set-cmake-paths.outputs.cmake-prefix-path }}" `
"-DCMAKE_INSTALL_PREFIX=${{ steps.set-cmake-paths.outputs.cmake-install-path }}" `
"-DBUILD_TESTING=OFF"
cmake --build --preset vs2022-windows-x86 --config RelWithDebInfo --target INSTALL --parallel 16
}
else {
cmake --preset vs2022-windows `
"-DCMAKE_PREFIX_PATH=${{ steps.set-cmake-paths.outputs.cmake-prefix-path }}" `
"-DCMAKE_INSTALL_PREFIX=${{ steps.set-cmake-paths.outputs.cmake-install-path }}" `
"-DBUILD_TESTING=OFF"
cmake --build --preset vs2022-windows --config RelWithDebInfo --target INSTALL --parallel 16
}
Pop-Location
}
- uses: actions/checkout@v3
if: inputs.mo2-skip-checkout != 'true'
with:
path: ./build/${{ github.event.repository.name }}
- name: Configure Repository
if: inputs.mo2-skip-checkout != 'true' && inputs.mo2-skip-configure != 'true'
shell: pwsh
run: |
Push-Location build/${{ github.event.repository.name }}
cmake --preset vs2022-windows `
"-DCMAKE_PREFIX_PATH=${{ steps.set-cmake-paths.outputs.cmake-prefix-path }}" `
"-DCMAKE_INSTALL_PREFIX=${{ steps.set-cmake-paths.outputs.cmake-install-path }}" `
"-DBUILD_TESTING=ON"
Pop-Location
# build repository
- name: Build Repository
if: inputs.mo2-skip-checkout != 'true' && inputs.mo2-skip-configure != 'true' && inputs.mo2-skip-build != 'true'
shell: pwsh
run: |
cmake --build --preset vs2022-windows --config RelWithDebInfo --parallel 16
working-directory: ./build/${{ github.event.repository.name }}