@@ -2,153 +2,158 @@ name: Build
22
33on :
44 pull_request :
5- branches : [main, master]
5+ branches :
6+ - main
7+ - master
8+
69 workflow_dispatch :
710 inputs :
8- skip_windows :
9- description : ' Skip building Windows binary'
10- required : false
11- default : false
11+ build_linux :
12+ description : Build Linux
13+ type : boolean
14+ default : true
15+
16+ build_windows :
17+ description : Build Windows
1218 type : boolean
19+ default : true
20+
21+ concurrency :
22+ group : build-${{ github.ref }}
23+ cancel-in-progress : true
1324
1425jobs :
26+
1527 build-linux :
28+ if : github.event_name != 'workflow_dispatch' || inputs.build_linux
29+
1630 runs-on : ubuntu-22.04
31+
1732 permissions :
1833 contents : write
1934
2035 steps :
21- - uses : actions/checkout@v6.0.3
36+ - uses : actions/checkout@v6
37+
38+ - name : Cache AppImage builder
39+ uses : actions/cache@v5
40+ with :
41+ path : ~/.cache/appimage-builder
42+ key : appimage-${{ hashFiles('AppImageBuilder.yml') }}
2243
2344 - name : Install dependencies
2445 run : |
25- sudo apt-get update -y
46+ sudo apt-get update
47+
2648 sudo apt-get install -y \
27- cmake ninja-build \
49+ ninja-build \
50+ cmake \
2851 libopencv-dev \
29- libx11-dev libxext-dev
52+ libx11-dev \
53+ libxext-dev
3054
31- - name : Make glue.sh executable
55+ - name : Make glue executable
3256 run : chmod +x glue.sh
3357
34- - name : Configure and build using glue.sh
58+ - name : Build
3559 run : |
3660 ./glue.sh build \
3761 -t Release \
3862 -j $(nproc) \
39- -D CMAKE_GENERATOR=Ninja \
40- -D CMAKE_CXX_FLAGS="-O2 -pipe -fstack-protector-strong" \
41- -D CMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro,-z,now"
63+ -D CMAKE_GENERATOR=Ninja
4264
4365 - name : Build AppImage
66+ if : github.event_name != 'pull_request'
4467 uses : AppImageCrafters/build-appimage-action@master
4568 with :
4669 recipe : AppImageBuilder.yml
4770 env :
4871 UPDATE_INFO : gh-releases-zsync|${{ github.repository_owner }}|${{ github.event.repository.name }}|latest|*x86_64.AppImage.zsync
4972
50- - name : Upload build artifact
51- uses : actions/upload-artifact@v7.0.1
73+ - name : Upload artifact
74+ uses : actions/upload-artifact@v4
5275 with :
5376 name : aimbot-linux-x86_64
54- path : aimbot-*.AppImage
77+ path : |
78+ aimbot-*.AppImage
79+ build/aimbot
5580
56- - name : Attach to release
81+ - name : Attach release
5782 if : startsWith(github.ref, 'refs/tags/')
58- uses : softprops/action-gh-release@v3.0.0
83+ uses : softprops/action-gh-release@v3
5984 with :
6085 files : aimbot-*.AppImage
6186
62- - name : Trigger CoreOS-repo package build
87+ - name : Trigger CoreOS package build
6388 if : startsWith(github.ref, 'refs/tags/')
6489 env :
6590 TAG : ${{ github.ref_name }}
6691 run : |
6792 VERSION="${TAG#v}"
93+
6894 curl -s -X POST \
6995 -H "Accept: application/vnd.github.v3+json" \
7096 -H "Authorization: Bearer ${{ secrets.COREOS_REPO_TOKEN }}" \
7197 https://api.github.com/repos/Frank1o3/CoreOS-repo/dispatches \
7298 -d "{\"event_type\":\"aimbot-release\",\"client_payload\":{\"package\":\"aimbot\",\"version\":\"${VERSION}\"}}"
7399
74100 build-windows :
75- # Run only if:
76- # - It's a pull_request (always), OR
77- # - It's a workflow_dispatch and the skip_windows checkbox is NOT checked
78- if : github.event_name != 'workflow_dispatch' || !github.event.inputs.skip_windows
101+ if : github.event_name != 'workflow_dispatch' || inputs.build_windows
102+
79103 runs-on : windows-latest
104+
80105 permissions :
81106 contents : write
82107
83108 env :
84109 VCPKG_DEFAULT_TRIPLET : x64-windows-static
85- VCPKG_DEFAULT_BINARY_CACHE : ${{ github.workspace }}\.vcpkg-cache
86- FETCHCONTENT_BASE_DIR : ${{ github.workspace }}\.fetchcontent-cache
87110
88111 steps :
89- - uses : actions/checkout@v6.0.3
112+ - uses : actions/checkout@v6
90113
91- - name : Create cache dirs
92- run : |
93- New-Item -ItemType Directory -Force -Path "$env:VCPKG_DEFAULT_BINARY_CACHE"
94- New-Item -ItemType Directory -Force -Path "$env:FETCHCONTENT_BASE_DIR"
95-
96- - name : Cache vcpkg binaries
97- uses : actions/cache@v5.0.5
98- with :
99- path : ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
100- key : vcpkg-opencv-core-imgproc-highgui-x64-static-v1
101- restore-keys : vcpkg-opencv-core-imgproc-highgui-x64-static-
114+ - name : Setup Ninja
115+ uses : seanmiddleditch/gha-setup-ninja@v6
102116
103- - name : Cache vcpkg installed
104- id : vcpkg-installed
105- uses : actions/cache@v5.0.5
117+ - name : Cache vcpkg
118+ uses : actions/cache@v5
106119 with :
107- path : ${{ env.VCPKG_INSTALLATION_ROOT }}\installed
108- key : vcpkg-installed-opencv-core-imgproc-highgui-x64-static-v1
109- restore-keys : vcpkg-installed-opencv-core-imgproc-highgui-x64-static-
110-
111- - name : Install OpenCV via vcpkg
112- if : steps.vcpkg-installed.outputs.cache-hit != 'true'
113- run : vcpkg install "opencv:x64-windows-static"
120+ path : |
121+ ${{ env.VCPKG_INSTALLATION_ROOT }}\downloads
122+ ${{ env.VCPKG_INSTALLATION_ROOT }}\installed
123+ key : vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
114124
115125 - name : Cache FetchContent
116- uses : actions/cache@v5.0.5
117- with :
118- path : ${{ env.FETCHCONTENT_BASE_DIR }}
119- key : fetchcontent-${{ hashFiles('**/CMakeLists.txt') }}
120- restore-keys : fetchcontent-
121-
122- - name : Cache build directory
123- uses : actions/cache@v5.0.5
126+ uses : actions/cache@v5
124127 with :
125- path : build/windows
126- key : build-windows-${{ hashFiles('src/**', 'includes/**', 'CMakeLists.txt') }}
127- restore-keys : build-windows-
128+ path : |
129+ build/_deps
130+ key : fetchcontent-${{ hashFiles('CMakeLists.txt') }}
128131
129132 - name : Configure
130133 run : |
131- cmake -S . -B build/windows `
134+ cmake -S . -B build `
135+ -G Ninja `
132136 -DCMAKE_BUILD_TYPE=Release `
133137 -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
134138 -DVCPKG_TARGET_TRIPLET=x64-windows-static `
135- -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded `
136- -DFETCHCONTENT_BASE_DIR="${{ env.FETCHCONTENT_BASE_DIR }}"
139+ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
137140
138141 - name : Build
139- run : cmake --build build/windows --config Release --parallel
142+ run : |
143+ cmake --build build --parallel
140144
141- - name : Rename artifact
142- run : Copy-Item build/windows/Release/aimbot.exe aimbot-windows-x86_64.exe
145+ - name : Rename executable
146+ run : |
147+ Copy-Item build/aimbot.exe aimbot-windows-x86_64.exe
143148
144- - name : Upload build artifact
145- uses : actions/upload-artifact@v7.0.1
149+ - name : Upload artifact
150+ uses : actions/upload-artifact@v4
146151 with :
147152 name : aimbot-windows-x86_64
148153 path : aimbot-windows-x86_64.exe
149154
150- - name : Attach to release
155+ - name : Attach release
151156 if : startsWith(github.ref, 'refs/tags/')
152- uses : softprops/action-gh-release@v3.0.0
157+ uses : softprops/action-gh-release@v3
153158 with :
154159 files : aimbot-windows-x86_64.exe
0 commit comments