1
+ # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2
+ # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3
+ name : Build XC Reader for multi platforms.
4
+
5
+ on :
6
+ push :
7
+ branches : [ "main" ]
8
+ pull_request :
9
+ branches : [ "main" ]
10
+ workflow_dispatch :
11
+
12
+ jobs :
13
+ build :
14
+ runs-on : ${{ matrix.os }}
15
+ strategy :
16
+ # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
17
+ fail-fast : false
18
+
19
+ # Set up a matrix to run the following 3 configurations:
20
+ # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
21
+ # 2. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
22
+ #
23
+ # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
24
+ matrix :
25
+ os : [ ubuntu-latest, windows-latest, macos-latest ]
26
+ arch : [ x86_64, aarch64 ]
27
+ build_type : [ Release ]
28
+ c_compiler : [ clang, cl ]
29
+ include :
30
+ - os : windows-latest
31
+ c_compiler : cl
32
+ cpp_compiler : cl
33
+ - os : ubuntu-latest
34
+ c_compiler : clang
35
+ exclude :
36
+ - os : windows-latest
37
+ c_compiler : clang
38
+ - os : windows-latest
39
+ arch : aarch64
40
+ - os : ubuntu-latest
41
+ c_compiler : cl
42
+ - os : macos-latest
43
+ c_compiler : cl
44
+ - os : macos-latest
45
+ arch : aarch64
46
+
47
+ steps :
48
+ - uses : actions/checkout@v4
49
+
50
+ - name : Set reusable strings
51
+ id : strings
52
+ shell : bash
53
+ run : |
54
+ echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
55
+ echo >> $GITHUB_ENV
56
+
57
+ - name : Configure Compiler
58
+ if : ${{ matrix.os == 'ubuntu-latest' }}
59
+ run : |
60
+ sudo apt install gcc-aarch64-linux-gnu
61
+ echo -e \\nset\(CMAKE_C_FLAGS "--target=${{ matrix.arch }}-linux-gnu"\) \\n >> ${{ github.workspace }}/CMakeLists.txt
62
+
63
+ - name : Configure CMake
64
+ run : >
65
+ cmake -B ${{ steps.strings.outputs.build-output-dir }}
66
+ -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
67
+ -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
68
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
69
+ -S ${{ github.workspace }}
70
+
71
+ - name : Build Patcher.
72
+ run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target xcreader
73
+
74
+ - name : Set Release Tag and Name
75
+ id : set_tag_name
76
+ run : |
77
+ current_time=$(date +"%y.%U.%H.%M")
78
+ echo "TAG_NAME=release-${current_time}" >> $GITHUB_ENV
79
+ echo "RELEASE_NAME=Release ${current_time}" >> $GITHUB_ENV
80
+
81
+ - name : Create Release
82
+ id : create_release
83
+ uses : actions/create-release@v1
84
+ if : ${{ matrix.arch == 'x86_64' && matrix.os == 'ubuntu-latest' }}
85
+ env :
86
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
87
+ with :
88
+ tag_name : ${{ env.TAG_NAME }}
89
+ release_name : ${{ env.RELEASE_NAME }}
90
+ draft : false
91
+ prerelease : false
92
+
93
+ - name : Upload Windows x64 Artifact
94
+ uses : actions/upload-release-asset@v1
95
+ if : ${{ matrix.arch == 'x86_64' && matrix.os == 'windows-latest' }}
96
+ env :
97
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98
+ with :
99
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
100
+ asset_name : XBLConfigReader-Windows-x64
101
+ asset_path : |
102
+ ${{ steps.strings.outputs.build-output-dir }}/**/xcreader.exe
103
+ asset_content_type : application/zip
104
+
105
+ - name : Upload Linux x64 Artifact
106
+ uses : actions/upload-release-asset@v1
107
+ if : ${{ matrix.arch == 'x86_64' && matrix.os == 'ubuntu-latest' }}
108
+ env :
109
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
110
+ with :
111
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
112
+ asset_name : XBLConfigReader-Linux-x64
113
+ asset_path : |
114
+ ${{ steps.strings.outputs.build-output-dir }}/xcreader
115
+ asset_content_type : application/zip
116
+
117
+ - name : Upload MacOS x64 Artifact
118
+ uses : actions/upload-release-asset@v1
119
+ if : ${{ matrix.arch == 'x86_64' && matrix.os == 'macos-latest' }}
120
+ env :
121
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122
+ with :
123
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
124
+ asset_name : XBLConfigReader-MacOS-x64
125
+ asset_path : |
126
+ ${{ steps.strings.outputs.build-output-dir }}/xcreader
127
+ asset_content_type : application/zip
128
+
129
+ - name : Upload Linux arm64 Artifact
130
+ uses : actions/upload-release-asset@v1
131
+ if : ${{ matrix.arch == 'aarch64' && matrix.os == 'ubuntu-latest' }}
132
+ env :
133
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134
+ with :
135
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
136
+ asset_name : XBLConfigReader-Linux-arm64
137
+ asset_path : |
138
+ ${{ steps.strings.outputs.build-output-dir }}/xcreader
139
+ asset_content_type : application/zip
0 commit comments