Skip to content

Commit

Permalink
feat: add github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jan 31, 2024
1 parent c2ec705 commit 2fd2ca4
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 3 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
build_windows:
name: Build on Windows
runs-on: windows-2022

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'

- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64
toolset: 14.3

- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest

- name: Set up Conan
run: |
python -m pip install -U conan
conan profile detect --force
conan export third_party/funchook --version 1.1.3
conan install . --build=missing -pr:a .github/conan_profiles/windows
- name: Build with Conan
run: conan build . -pr:a .github/conan_profiles/windows

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: endstone-cpp-plugin-windows
path: ./build/Release/*.dll

build_linux:
name: Build on Ubuntu
runs-on: ubuntu-20.04

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'

- name: Set up Clang 15
env:
LLVM_VERSION: 15
run: |
sudo apt-get update -y -q
sudo apt-get install -y -q lsb-release wget software-properties-common gnupg
sudo wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh ${LLVM_VERSION}
sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
- name: Set up CMake and Ninja
uses: lukka/get-cmake@latest

- name: Set up Conan
run: |
python -m pip install -U conan
conan profile detect --force
conan export third_party/funchook --version 1.1.3
conan install . --build=missing -pr:a .github/conan_profiles/linux
- name: Build with Conan
run: conan build . -pr:a .github/conan_profiles/linux

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: endstone-cpp-plugin-linux
path: ./build/Release/*.so
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json
.idea
build
3 changes: 0 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,3 @@ def build(self):
def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["endstone_cpp_plugin"]

0 comments on commit 2fd2ca4

Please sign in to comment.