Merge pull request #152 from c3rb3ru5d3d53c/wheel #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: [push, pull_request] | |
jobs: | |
build: | |
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- windows | |
- macos | |
include: | |
- target: ubuntu-20.04 | |
os: ubuntu-20.04 | |
build-type: Release | |
extra-cmake-flags: >- | |
"-DBUILD_PYTHON_BINDINGS=ON" | |
- target: ubuntu-22.04 | |
os: ubuntu-22.04 | |
build-type: Release | |
extra-cmake-flags: >- | |
"-DBUILD_PYTHON_BINDINGS=ON" | |
- target: windows | |
os: windows-latest | |
build-type: Release | |
extra-cmake-flags: >- | |
"-DBUILD_PYTHON_BINDINGS=ON" | |
- target: macos | |
os: macOS-latest | |
build-type: Release | |
extra-cmake-flags: >- | |
"-DBUILD_PYTHON_BINDINGS=ON" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Install ninja-build tool | |
uses: seanmiddleditch/gha-setup-ninja@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: | | |
3.8 | |
3.9 | |
3.10 | |
- name: Enable Developer Command Prompt | |
if: ${{ runner.os == 'Windows' }} | |
uses: ilammy/msvc-dev-cmd@v1.7.0 | |
- name: Set up GCC | |
if: ${{ runner.os == 'Linux' }} | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: 9 | |
- name: Build Deps | |
run: | | |
cmake -B deps/build -S deps | |
cmake --build deps/build --config ${{ matrix.build-type }} --parallel 4 | |
- name: Build | |
run: | | |
cmake -B build ${{ matrix.extra-cmake-flags }} | |
cmake --build build --config ${{ matrix.build-type }} --parallel 4 | |
cmake --install build --prefix build/install --config ${{ matrix.build-type }} | |
- name: Build Python Unix | |
if: ${{ runner.os != 'Windows' }} | |
run: | | |
python3.8 -m pip wheel -v -w ${{ github.workspace }}/build/ . | |
python3.9 -m pip wheel -v -w ${{ github.workspace }}/build/ . | |
python3.10 -m pip wheel -v -w ${{ github.workspace }}/build/ . | |
- name: Build Python Windows | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
py -3.8 -m pip wheel -v -w ${{ github.workspace }}/build/ . | |
py -3.9 -m pip wheel -v -w ${{ github.workspace }}/build/ . | |
py -3.10 -m pip wheel -v -w ${{ github.workspace }}/build/ . | |
- name: Package | |
run: | | |
cd build/ && cpack | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ github.event.repository.name }}-${{ matrix.target }} | |
path: | | |
build/binlex | |
build/blyara | |
build/*.so | |
build/*.deb | |
build/*.exe | |
build/*.dll | |
build/*.lib | |
build/*.tar.gz | |
build/*.rpm | |
build/*.a | |
build/pybinlex*.whl | |
build/*.dmg | |
- name: Compress artifacts | |
uses: vimtor/action-zip@v1 | |
with: | |
files: build/install/bin/ | |
dest: ${{ github.event.repository.name }}-${{ matrix.target }}.zip | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
with: | |
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') || contains(github.ref, '-pre') }} | |
files: ${{ github.event.repository.name }}-${{ matrix.target }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |