-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from alienc0der/cicd
cicd: create pipeline
- Loading branch information
Showing
5 changed files
with
232 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
name: Report a bug | ||
about: Something with znn-pow-links is not working as expected | ||
title: '' | ||
labels: 'type:bug' | ||
assignees: '' | ||
--- | ||
|
||
#### System information | ||
|
||
OS & Version: Windows/Linux/OSX | ||
Commit hash : (if `develop`) | ||
|
||
#### Expected behaviour | ||
|
||
|
||
#### Actual behaviour | ||
|
||
|
||
#### Steps to reproduce the behaviour | ||
|
||
|
||
#### Backtrace | ||
|
||
```` | ||
[backtrace] | ||
```` | ||
|
||
When submitting logs: please submit them as text and not screenshots. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
name: Build and release libpow_links | ||
|
||
on: | ||
push: | ||
branches: | ||
- cicd | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-macos: | ||
runs-on: macos-12 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup environment | ||
run: | | ||
brew install cmake emscripten | ||
brew cleanup | ||
cmake --version | ||
emcc --version | ||
- name: Setup ios-cmake | ||
run: git clone https://github.com/leetal/ios-cmake.git | ||
- name: Create output directories for resulting binaries | ||
run: | | ||
mkdir ios64 | ||
mkdir simulator64 | ||
mkdir darwin | ||
mkdir wasm | ||
mkdir releases | ||
- name: Build ios-arm64 framework | ||
run: | | ||
cmake CMakeLists.txt -G Xcode -DCMAKE_TOOLCHAIN_FILE=ios-cmake/ios.toolchain.cmake -DPLATFORM=OS64 | ||
cmake --build . --config Release | ||
cp -R build/Release/pow_links.framework/ ios64/pow_links.framework | ||
- name: Cleanup action | ||
run: rm -rf CMakeFiles/ CMakeCache.txt build/* | ||
- name: Build ios-simulator-x86_64 framework | ||
run: | | ||
cmake CMakeLists.txt -G Xcode -DCMAKE_TOOLCHAIN_FILE=ios-cmake/ios.toolchain.cmake -DPLATFORM=SIMULATOR64 | ||
cmake --build . --config Release | ||
cp -R build/Release/pow_links.framework/ simulator64/pow_links.framework | ||
- name: Cleanup action | ||
run: rm -rf CMakeFiles/ CMakeCache.txt build/* | ||
- name: Build darwin dynamic library and framework | ||
run: | | ||
cmake CMakeLists.txt | ||
cmake --build . --config Release | ||
cp -R build/pow_links.framework/ darwin/pow_links.framework | ||
cp build/pow_links.framework/Versions/C/pow_links darwin/libpow_links.dylib | ||
cp build/generator darwin/generator | ||
- name: Cleanup action | ||
run: rm -rf CMakeFiles/ CMakeCache.txt build/* | ||
- name: Build wasm | ||
run: emcc -O3 -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' -s EXPORT_ALL=1 -s LINKABLE=1 src/pow_links.cpp SHA3IUF/sha3.c src/bridge.cpp -o wasm/znn-pow-links.js | ||
- name: Create xcframework | ||
run: xcodebuild -create-xcframework -framework darwin/pow_links.framework -framework ios64/pow_links.framework -framework simulator64/pow_links.framework -output pow_links.xcframework | ||
- name: Archive files | ||
run: | | ||
zip -r pow_links.xcframework.zip pow_links.xcframework | ||
zip -j libpow_links-darwin-universal.zip darwin/libpow_links.dylib darwin/generator | ||
zip -jr libpow_links-wasm.zip wasm/* | ||
- name: Copy archived files to releases | ||
run: cp pow_links.xcframework.zip libpow_links-darwin-universal.zip libpow_links-wasm.zip releases/ | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: macos-artifacts | ||
path: releases/ | ||
build-linux: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup environment | ||
run: | | ||
sudo apt update | ||
sudo apt upgrade -y | ||
sudo apt install -y build-essential cmake zip unzip wget mingw-w64 gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
cmake --version | ||
- name: Create output directories for resulting binaries | ||
run: | | ||
mkdir linux-amd64 | ||
mkdir linux-arm64 | ||
mkdir android-arm64_v8a | ||
mkdir windows-amd64 | ||
mkdir releases | ||
- name: Build linux-amd64 shared library | ||
run: | | ||
cmake CMakeLists.txt | ||
cmake --build . --config Release | ||
cp build/libpow_links.so linux-amd64/libpow_links.so | ||
- name: Cleanup action | ||
run: rm -rf CMakeFiles/ CMakeCache.txt build/* | ||
- name: Build linux-arm64 shared library | ||
run: | | ||
cmake CMakeLists.txt -DCMAKE_TOOLCHAIN_FILE=aarch64-linux-gnu.cmake | ||
cmake --build . --config Release | ||
cp build/libpow_links.so linux-arm64/libpow_links.so | ||
- name: Cleanup action | ||
run: rm -rf CMakeFiles/ CMakeCache.txt build/* | ||
- name: Setup Android NDK | ||
run: | | ||
wget -q https://dl.google.com/android/repository/android-ndk-r25-linux.zip | ||
unzip -q android-ndk-r25-linux.zip | ||
- name: Build android-arm64_v8a shared library | ||
run: | | ||
cmake CMakeLists.txt -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_ANDROID_NDK=/home/runner/work/znn-pow-links-cpp/znn-pow-links-cpp/android-ndk-r25 -DCMAKE_ANDROID_STL_TYPE=c++_shared | ||
cmake --build . --config Release | ||
cp build/libpow_links.so android-arm64_v8a/libpow_links.so | ||
- name: Cleanup action | ||
run: rm -rf CMakeFiles/ CMakeCache.txt build/* | ||
- name: Build windows-amd64 dynamic library | ||
run: | | ||
cmake CMakeLists.txt -DCMAKE_TOOLCHAIN_FILE=mingw-w64-x86_64.cmake | ||
cmake --build . --config Release | ||
cp build/libpow_links.dll windows-amd64/libpow_links.dll | ||
cp build/generator.exe windows-amd64/generator.exe | ||
- name: Archive files | ||
run: | | ||
zip -jr libpow_links-linux-amd64.zip linux-amd64/* | ||
zip -jr libpow_links-linux-arm64.zip linux-arm64/* | ||
zip -jr libpow_links-android-arm64_v8a.zip android-arm64_v8a/* | ||
zip -jr libpow_links-windows-amd64.zip windows-amd64/* | ||
- name: Copy archived files to releases | ||
run: cp libpow_links-linux-amd64.zip libpow_links-linux-arm64.zip libpow_links-android-arm64_v8a.zip libpow_links-windows-amd64.zip releases/ | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: linux-artifacts | ||
path: releases/ | ||
make-release: | ||
needs: [build-macos, build-linux] | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: macos-artifacts | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: linux-artifacts | ||
- name: Prepare releases directory | ||
run: | | ||
mkdir releases | ||
cp pow_links.xcframework.zip libpow_links-darwin-universal.zip libpow_links-wasm.zip libpow_links-linux-amd64.zip libpow_links-linux-arm64.zip libpow_links-android-arm64_v8a.zip libpow_links-windows-amd64.zip releases/ | ||
- name: Generate checksums | ||
run: | | ||
cd releases | ||
echo $(sha256sum *) >> SHA256CHECKSUMS.txt | ||
- name: Upload files to a GitHub release | ||
uses: svenstaro/upload-release-action@2.5.0 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: releases/* | ||
tag: v0.0.1-alpha | ||
file_glob: true | ||
overwrite: true | ||
body: "" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,47 @@ | ||
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(pow_links) | ||
|
||
cmake_minimum_required(VERSION 3.2) | ||
enable_language(CXX) | ||
|
||
# fetch submodules | ||
execute_process ( | ||
COMMAND bash -c "git submodule init && git submodule update && cd SHA3IUF && git checkout e909ac7791ac4335eb4382332ef56eb021dde482" | ||
) | ||
|
||
# compile options | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||
set(CMAKE_CXX_FLAGS "-Wall -static -static-libstdc++ -O3") | ||
set(CMAKE_C_FLAGS "-Wall -static -static-libgcc -O3") | ||
else() | ||
set(CMAKE_CXX_FLAGS "-Wall -static-libstdc++ -O3") | ||
set(CMAKE_C_FLAGS "-Wall -static-libgcc -O3") | ||
endif() | ||
|
||
|
||
set(SOURCE_DIR "src/") | ||
|
||
# generate in build/ | ||
set(LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build") | ||
set(BIN_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build") | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_PATH}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN_PATH}) | ||
|
||
# library | ||
add_library(pow_links SHARED src/bridge.cpp src/bridge.def src/pow_links.cpp SHA3IUF/sha3.c) | ||
add_executable(generator src/generator.cpp src/pow_links.cpp SHA3IUF/sha3.c) | ||
set(public_headers "${CMAKE_CURRENT_SOURCE_DIR}/src/bridge.hpp") | ||
|
||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) | ||
|
||
add_library(pow_links SHARED src/bridge.hpp src/bridge.cpp src/bridge.def src/pow_links.cpp SHA3IUF/sha3.c) | ||
|
||
if(CMAKE_SYSTEM MATCHES Windows OR CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES Darwin) | ||
add_executable(generator src/generator.cpp src/pow_links.cpp SHA3IUF/sha3.c) | ||
endif() | ||
|
||
set_target_properties(pow_links PROPERTIES | ||
FRAMEWORK TRUE | ||
FRAMEWORK_VERSION C | ||
MACOSX_FRAMEWORK_IDENTIFIER network.zenon.powlinks | ||
VERSION 0.0.1 | ||
SOVERSION 1.0.0 | ||
PUBLIC_HEADER "${public_headers}" | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR aarch64) | ||
set(TOOLCHAIN_PREFIX aarch64-linux-gnu) | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) | ||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) | ||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |