Skip to content

Commit

Permalink
Merge pull request #2 from symplely/master
Browse files Browse the repository at this point in the history
Added Github Actions CI
  • Loading branch information
XiaochenCui committed Jun 14, 2023
2 parents 8af012f + a1fe2df commit ca19850
Show file tree
Hide file tree
Showing 20 changed files with 275 additions and 105 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: windows & linux

on: [push, pull_request]

jobs:
build:
name: ${{ matrix.target }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- target: amd64
flags: -O3 -fomit-frame-pointer
- target: x86
flags: -m32 -O3 -fomit-frame-pointer
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -q -y
sudo apt-get install -y gcc-multilib g++-multilib valgrind libc6-dbg libc6-dbg:i386
- name: cmake build & test example
run: |
mkdir build
cd build
cmake ..
cmake --build .
cd bin
./chan_3
./primes
./testdelay 2
build-windows:
name: Windows (${{ matrix.arch }})
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
arch: [amd64, x86]
steps:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- uses: actions/checkout@v3
- name: cmake build & test examples
run: |
mkdir build
cd build
cmake .. -D CMAKE_GENERATOR_PLATFORM=Win32
cmake --build .
cd bin/Debug
.\chan_1.exe
.\chan_2.exe
.\chan_3.exe
.\primes.exe
.\testdelay.exe 2
42 changes: 42 additions & 0 deletions .github/workflows/ci_qemu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: arch64 & others by qemu

on: [push, pull_request]

jobs:
build-qemu:
name: ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: aarch64
arch: aarch64
- target: ppc64v2
arch: ppc64le
- target: riscv64
arch: riscv64
- target: s390x
arch: s390x
steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
distro: ubuntu_latest
install: |
apt-get update -q -y
apt-get install -q -y --no-install-recommends cmake build-essential
env: |
# Valgrind on arm will fail if the stack size is larger than 8MB.
# Set QEMUs stack size to 8MB since Github runners use 16MB default.
QEMU_STACK_SIZE: 8388608
run: |
mkdir build
cd build
cmake ..
cmake --build .
cd bin
./chan_3
./primes
./testdelay 2
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ cmake_minimum_required(VERSION 3.10)

project(LIBTASK C)

set(C_STANDARD 99)
set(C_STANDARD 89)

# -g for debugging
set(CMAKE_C_FLAGS "-g")
if(UNIX)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -fomit-frame-pointer ")
endif()

message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}")

set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BUILD_DIR}/bin)
Expand All @@ -17,10 +21,9 @@ file(GLOB lib_files
)
add_library(task STATIC ${lib_files})

set(TARGET_LIST primes tcpproxy helloworld chan_1 chan_2 chan_3)
set(TARGET_LIST testdelay primes helloworld chan_1 chan_2 chan_3)
foreach (TARGET ${TARGET_LIST})
add_executable(${TARGET} examples/${TARGET}.c)
target_include_directories(${TARGET} PRIVATE src)
target_link_libraries(${TARGET} task)
endforeach()
libtask
Loading

0 comments on commit ca19850

Please sign in to comment.