Skip to content

Commit 93f6e4f

Browse files
authored
Merge pull request #30 from shad0wshayd3-FO4/master-build
feat: update workflows, add xmake workflow
2 parents c7295d0 + 4c8baa4 commit 93f6e4f

5 files changed

Lines changed: 122 additions & 108 deletions

File tree

.github/workflows/main_ci.yml

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
1-
name: build
1+
name: Main CI
22

33
on:
44
push:
55
branches: [ master ]
6+
paths:
7+
- '.github/workflows/main_ci.yml'
8+
- 'cmake/**'
9+
- 'include/**'
10+
- 'src/**'
11+
- 'CMakeLists.txt'
12+
- 'CMakePresets.json'
13+
- 'vcpkg.json'
614
pull_request:
715
branches: [ master ]
816
workflow_dispatch:
917

1018
env:
19+
BUILD_TYPE: Debug
1120
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache
1221

1322
jobs:
1423
windows:
15-
runs-on: windows-2022
16-
strategy:
17-
fail-fast: false
18-
matrix:
19-
build-type:
20-
- debug
21-
- release
22-
compiler:
23-
- msvc
24+
runs-on: windows-latest
2425
steps:
25-
- name: Checkout
26-
uses: actions/checkout@v2
26+
- uses: actions/checkout@v2
2727
with:
2828
path: main
29-
30-
- name: Setup cmake
31-
uses: lukka/get-cmake@latest
32-
33-
- name: Setup msvc
34-
uses: ilammy/msvc-dev-cmd@v1.10.0
3529

3630
- name: Setup vcpkg
37-
uses: friendlyanon/setup-vcpkg@v1
31+
run: |
32+
mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
33+
cd $env:VCPKG_INSTALLATION_ROOT
34+
./bootstrap-vcpkg.bat
35+
./vcpkg --version > ${{ github.workspace }}/vcpkg-version.txt
36+
37+
- name: Cache vcpkg
38+
uses: actions/cache@v2
39+
id: vcpkg-cache
40+
env:
41+
cache-name: vcpkg-cache
3842
with:
39-
committish: 943c5ef1c8f6b5e6ced092b242c8299caae2ff01
43+
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}/*
44+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('main/**/vcpkg.json', 'vcpkg-version.txt') }}
45+
46+
- name: Configure CMake
47+
working-directory: ${{ github.workspace }}/main
48+
run: cmake --preset vs2022-windows-vcpkg
4049

4150
- name: Build
42-
uses: lukka/run-cmake@v10.0
43-
with:
44-
cmakeListsTxtPath: ${{ github.workspace }}/main/CMakeLists.txt
45-
configurePreset: build-${{ matrix.build-type }}-${{ matrix.compiler }}-vcpkg
46-
buildPreset: ${{ matrix.build-type }}-${{ matrix.compiler }}-vcpkg
51+
working-directory: ${{ github.workspace }}/main
52+
run: cmake --build build --config ${{ env.BUILD_TYPE }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Main CI [XMake]
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- ".github/workflows/main_ci_xmake.yml"
8+
- "include/**"
9+
- "src/**"
10+
- "xmake.lua"
11+
- "xmake-extra.lua"
12+
pull_request:
13+
branches: [ master ]
14+
workflow_dispatch:
15+
16+
jobs:
17+
build-xmake:
18+
runs-on: windows-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
mode:
23+
- debug
24+
- release
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup XMake
30+
uses: xmake-io/github-action-setup-xmake@v1
31+
with:
32+
xmake-version: "latest"
33+
34+
- name: Configure
35+
run: xmake config -y --mode=${{ matrix.mode }} --vs_toolset=14.41
36+
37+
- name: Build
38+
run: xmake build -y -vD

.github/workflows/maintenance.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
name: maintenance
22

3-
on: [push]
3+
on: push
44

55
jobs:
66
maintenance:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v2
1111

12-
- uses: actions/setup-python@v2
13-
with:
14-
python-version: '3.9'
12+
- uses: actions/setup-python@v2
13+
with:
14+
python-version: '3.9'
1515

16-
- name: Run clang-format
17-
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i
16+
- name: Run clang-format
17+
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i
1818

19-
- name: Glob files
20-
run: python ${{ github.workspace }}/CommonLibF4/scripts/glob_files.py
19+
- name: Glob files
20+
run: python ${{ github.workspace }}/CommonLibF4/scripts/cmake_generate.py
2121

22-
- uses: stefanzweifel/git-auto-commit-action@v4
23-
with:
24-
commit_message: maintenance
22+
- uses: stefanzweifel/git-auto-commit-action@v4
23+
with:
24+
commit_message: maintenance

CMakePresets.json

Lines changed: 41 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,72 @@
11
{
22
"configurePresets": [
33
{
4-
"name": "common",
5-
"hidden": true,
4+
"binaryDir": "${sourceDir}/build",
65
"cacheVariables": {
7-
"CMAKE_CXX_FLAGS": "$env{PROJECT_PLATFORM_FLAGS} $env{PROJECT_TEXT_FLAGS} $env{PROJECT_COMPILER_FLAGS} $penv{CXX_FLAGS}",
8-
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
9-
},
10-
"environment": {
11-
"PROJECT_ARCHITECTURE": "x64",
12-
"PROJECT_PLATFORM": "windows",
13-
"PROJECT_TEXT_FLAGS": "-DUNICODE -D_UNICODE"
6+
"CMAKE_BUILD_TYPE": {
7+
"type": "STRING",
8+
"value": "Debug"
9+
}
1410
},
1511
"errors": {
1612
"deprecated": true
1713
},
14+
"hidden": true,
15+
"name": "cmake-dev",
1816
"warnings": {
1917
"deprecated": true,
2018
"dev": true
21-
},
22-
"vendor": {
23-
"microsoft.com/VisualStudioSettings/CMake/1.0": {
24-
"intelliSenseMode": "$env{PROJECT_PLATFORM}-$env{PROJECT_COMPILER}-$env{PROJECT_ARCHITECTURE}",
25-
"enableMicrosoftCodeAnalysis": true,
26-
"enableClangTidyCodeAnalysis": true
27-
}
2819
}
2920
},
3021
{
31-
"name": "buildtype-debug",
32-
"hidden": true,
3322
"cacheVariables": {
34-
"CMAKE_BUILD_TYPE": "Debug"
35-
}
36-
},
37-
{
38-
"name": "buildtype-release",
23+
"CMAKE_TOOLCHAIN_FILE": {
24+
"type": "STRING",
25+
"value": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
26+
}
27+
},
3928
"hidden": true,
40-
"cacheVariables": {
41-
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
42-
}
29+
"name": "vcpkg"
4330
},
4431
{
45-
"name": "packaging-vcpkg",
46-
"hidden": true,
47-
"toolchainFile": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake",
4832
"cacheVariables": {
49-
"VCPKG_HOST_TRIPLET": "$env{PROJECT_ARCHITECTURE}-$env{PROJECT_PLATFORM}-static-md",
50-
"VCPKG_TARGET_TRIPLET": "$env{PROJECT_ARCHITECTURE}-$env{PROJECT_PLATFORM}-static-md"
51-
}
52-
},
53-
{
54-
"name": "generator-ninja",
55-
"hidden": true,
56-
"generator": "Ninja"
57-
},
58-
{
59-
"name": "compiler-msvc",
33+
"CMAKE_MSVC_RUNTIME_LIBRARY": {
34+
"type": "STRING",
35+
"value": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
36+
},
37+
"VCPKG_TARGET_TRIPLET": {
38+
"type": "STRING",
39+
"value": "x64-windows-static-md"
40+
}
41+
},
6042
"hidden": true,
61-
"environment": {
62-
"PROJECT_COMPILER_FLAGS": "/EHsc /MP /W4 /WX /external:W0 /bigobj",
63-
"PROJECT_COMPILER": "msvc"
64-
}
43+
"name": "windows"
6544
},
6645
{
67-
"name": "build-debug-msvc-vcpkg",
46+
"cacheVariables": {
47+
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:anglebrackets /external:W0"
48+
},
49+
"generator": "Visual Studio 16 2019",
6850
"inherits": [
69-
"common",
70-
"buildtype-debug",
71-
"packaging-vcpkg",
72-
"generator-ninja",
73-
"compiler-msvc"
51+
"cmake-dev",
52+
"vcpkg",
53+
"windows"
7454
],
75-
"binaryDir": "${sourceDir}/build/debug-msvc-vcpkg"
55+
"name": "vs2019-windows-vcpkg"
7656
},
7757
{
78-
"name": "build-release-msvc-vcpkg",
58+
"cacheVariables": {
59+
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX /external:W0"
60+
},
61+
"generator": "Visual Studio 17 2022",
7962
"inherits": [
80-
"common",
81-
"buildtype-release",
82-
"packaging-vcpkg",
83-
"generator-ninja",
84-
"compiler-msvc"
63+
"cmake-dev",
64+
"vcpkg",
65+
"windows"
8566
],
86-
"binaryDir": "${sourceDir}/build/release-msvc-vcpkg"
87-
}
88-
],
89-
"buildPresets": [
90-
{
91-
"name": "debug-msvc-vcpkg",
92-
"configurePreset": "build-debug-msvc-vcpkg",
93-
"displayName": "Debug (MSVC, Vcpkg)"
94-
},
95-
{
96-
"name": "release-msvc-vcpkg",
97-
"configurePreset": "build-release-msvc-vcpkg",
98-
"displayName": "Release (MSVC, Vcpkg)"
67+
"name": "vs2022-windows-vcpkg",
68+
"toolset": "v143"
9969
}
10070
],
101-
"version": 3
71+
"version": 2
10272
}

0 commit comments

Comments
 (0)