1+ name : CMake Debug
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ pull_request :
8+ branches :
9+ - ' **'
10+
11+ env :
12+ # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
13+ BUILD_TYPE : Debug
14+
15+ jobs :
16+ build :
17+ runs-on : ${{ matrix.os }}
18+ strategy :
19+ matrix :
20+ os : [ubuntu-latest, macos-latest, windows-2019]
21+ include :
22+ - os : ubuntu-latest
23+ artifact_dlib_ext : .so
24+ artifact_staticlib_ext : .a
25+ - os : windows-2019
26+ artifact_exec_ext : .exe
27+ artifact_dlib_ext : .dll
28+ artifact_staticlib_ext : .lib
29+ # Note: I wanted to use env.BUILD_TYPE, but it isn't taking
30+ # artifact_out_dir: ${{ BUILD_TYPE }}/
31+ artifact_out_dir : Debug/
32+ artifact_os_name : Windows
33+ artifact_arch : x86_64
34+ - os : macos-latest
35+ artifact_dlib_ext : .dylib
36+ artifact_staticlib_ext : .a
37+ steps :
38+ - uses : actions/checkout@v2
39+ - run : |
40+ sudo apt install libcapstone-dev nasm mingw-w64 libedit-dev \
41+ libgl1-mesa-dev mesa-utils libgl1-mesa-glx libxrandr-dev \
42+ libxinerama-dev libxcursor-dev libxi-dev
43+ if: matrix.os == 'ubuntu-latest'
44+ - run : brew install capstone nasm mingw-w64 glfw glm
45+ if : matrix.os == 'macOS-latest'
46+ - run : choco install python3 nasm
47+ if : matrix.os == 'windows-2019'
48+ - name : Create Build Environment
49+ # Some projects don't allow in-source building, so create a separate build directory
50+ # We'll use this as our working directory for all subsequent commands
51+ run : cmake -E make_directory ${{github.workspace}}/build
52+ - name : Cache C++ dependencies in Packages Directory
53+ uses : actions/cache@v3
54+ with :
55+ path : |
56+ ${{github.workspace}}/packages
57+ key : ${{ runner.OS }}-c++-packages-cache-${{ hashFiles('${{github.workspace}}/depsCache.json') }}
58+ restore-keys : |
59+ ${{ runner.OS }}-c++-packages-cache
60+ # NOTE: this is temporary until i understand a bit more why i can't build binutil
61+ # Monitored with issue-32 https://github.com/farzonl/Disassembler/issues/32
62+ - name : Configure CMake (Mac)
63+ if : matrix.os == 'macOS-latest'
64+ # Use a bash shell so we can use the same syntax for environment variable
65+ # access regardless of the host operating system
66+ shell : bash
67+ working-directory : ${{github.workspace}}/build
68+ # Note the current convention is to use the -S and -B options here to specify source
69+ # and build directories, but this is only available with CMake 3.13 and higher.
70+ # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
71+ run : cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
72+
73+ - name : Configure CMake (Linux\Windows)
74+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'windows-2019'
75+ # Use a bash shell so we can use the same syntax for environment variable
76+ # access regardless of the host operating system
77+ shell : bash
78+ working-directory : ${{github.workspace}}/build
79+ # Note the current convention is to use the -S and -B options here to specify source
80+ # and build directories, but this is only available with CMake 3.13 and higher.
81+ # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
82+ run : cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_INT_TESTS=true
83+
84+ - name : Build
85+ working-directory : ${{github.workspace}}/build
86+ shell : bash
87+ # Execute the build. You can specify a specific target with "--target <NAME>"
88+ run : cmake --build . --config $BUILD_TYPE
89+
90+ - name : Test (Unix-like)
91+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'
92+ working-directory : ${{github.workspace}}/build
93+ shell : bash
94+ # Execute tests defined by the CMake configuration.
95+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
96+ run : ./src/test/Disassembler_TEST
97+
98+ - name : Test Windows
99+ if : matrix.os == 'windows-2019'
100+ working-directory : ${{github.workspace}}/build
101+ shell : bash
102+ # Execute tests defined by the CMake configuration.
103+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
104+ run : ./src/test/$BUILD_TYPE/Disassembler_TEST.exe
105+ - name : Prepare Binaries for upload (Mac\Linux)
106+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'
107+ shell : bash
108+ run : |
109+ mkdir ${{github.workspace}}/artifacts
110+ cp build/src/libDisassembler${{ matrix.artifact_staticlib_ext }} ${{github.workspace}}/artifacts
111+ cp build/src/cli/disasm ${{github.workspace}}/artifacts
112+ cp build/src/gui/disasm-gui ${{github.workspace}}/artifacts
113+ cp build/plugins/xedPlugin/libxedPlugin${{ matrix.artifact_dlib_ext }} ${{github.workspace}}/artifacts
114+ pushd ${{github.workspace}}
115+ zip -r Gozihr-$(uname -s)-$(uname -m).zip artifacts
116+ popd
117+ - name : Prepare Binaries for upload (windows)
118+ if : matrix.os == 'windows-2019'
119+ shell : powershell
120+ run : |
121+ [system.io.directory]::CreateDirectory("${{github.workspace}}/artifacts")
122+ Copy-Item "build/src/${{ matrix.artifact_out_dir}}Disassembler${{ matrix.artifact_staticlib_ext }}" -Destination "${{github.workspace}}/artifacts"
123+ Copy-Item "build/src/cli/${{ matrix.artifact_out_dir }}disasm${{ matrix.artifact_exec_ext }}" -Destination "${{github.workspace}}/artifacts"
124+ Copy-Item "build/src/gui/${{ matrix.artifact_out_dir }}disasm-gui${{ matrix.artifact_exec_ext }}" -Destination "${{github.workspace}}/artifacts"
125+ Copy-Item "build/plugins/xedPlugin/${{ matrix.artifact_out_dir }}xedPlugin${{ matrix.artifact_dlib_ext }}" -Destination "${{github.workspace}}/artifacts"
126+ Compress-Archive -Path ${{github.workspace}}/artifacts/* -DestinationPath Gozihr-${{matrix.artifact_os_name}}-${{matrix.artifact_arch}}.zip
127+ - name : ' Upload Pull Request Artifact'
128+ uses : actions/upload-artifact@v3
129+ if : startsWith(github.ref, 'refs/pull/')
130+ with :
131+ name : Gozihr Pull Request Artifacts
132+ path : Gozihr-*.zip
133+ retention-days : 5
0 commit comments