Skip to content

Commit

Permalink
ci: Use GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: LIU Hao <[email protected]>
  • Loading branch information
lhmouse committed Oct 16, 2023
1 parent 9237001 commit e2aa74e
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 2 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: C/C++ CI

on:
push:
branches:
- master
- releases/*

pull_request:
branches:
- master

jobs:
ubuntu-x86-64:
name: Ubuntu cross build (x86_64)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Remove mono runtime
run: sudo apt-get purge mono-runtime

- name: Install dependencies
run: >-
sudo apt-get install -y --no-install-recommends autoconf automake
libtool make wine wine-binfmt mingw-w64-x86-64-dev mingw-w64-tools
gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64
- name: Run tests
run: >-
CONFIGURE_BUILD=x86_64-pc-linux
CONFIGURE_HOST=x86_64-w64-mingw32
CC=x86_64-w64-mingw32-gcc-win32
./ci/build.sh
msys2-ucrt64:
name: MSYS2 native build (x86_64)
runs-on: windows-latest

defaults:
run:
shell: msys2 {0}

steps:
- uses: actions/checkout@v3

- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64

- name: Install dependencies
run: >-
pacman -S --noconfirm autoconf automake libtool gettext make
mingw-w64-ucrt-x86_64-headers-git mingw-w64-ucrt-x86_64-crt-git
mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-binutils
- name: Run tests
run: ./ci/build.sh

msys2-mingw32:
name: MSYS2 native build (i686)
runs-on: windows-latest

defaults:
run:
shell: msys2 {0}

steps:
- uses: actions/checkout@v3

- uses: msys2/setup-msys2@v2
with:
msystem: MINGW32

- name: Install dependencies
run: >-
pacman -S --noconfirm autoconf automake libtool gettext make
mingw-w64-i686-headers-git mingw-w64-i686-crt-git
mingw-w64-i686-gcc mingw-w64-i686-binutils
- name: Run tests
run: ./ci/build.sh
16 changes: 14 additions & 2 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@
# setup
export CC=${CC:-"gcc"}
export CFLAGS='-O0 -g0'
export DISTCHECK_CONFIGURE_FLAGS="${CONFIGURE_OPTS}"

# build
if test "${CONFIGURE_BUILD}" != ""
then
DISTCHECK_CONFIGURE_FLAGS="--build=${CONFIGURE_BUILD} ${DISTCHECK_CONFIGURE_FLAGS}"
fi

if test "${CONFIGURE_HOST}" != ""
then
DISTCHECK_CONFIGURE_FLAGS="--host=${CONFIGURE_HOST} ${DISTCHECK_CONFIGURE_FLAGS}"
CC="${CONFIGURE_HOST}-gcc"
fi

${CC} --version
mkdir -p m4
autoreconf -ifv

cd $(mktemp -d)
trap 'rm -rf ~+ || true' EXIT
~-/configure --{build,host}=${CONFIGURE_HOST} ${CONFIGURE_OPTS} \
~-/configure ${DISTCHECK_CONFIGURE_FLAGS} \
--disable-dependency-tracking --disable-silent-rules --enable-debug-checks

# test
if ! make -j$(nproc) distcheck DISTCHECK_CONFIGURE_FLAGS=${CONFIGURE_OPTS}
if ! make -j$(nproc) distcheck
then
find . -name 'test-suite.log' -exec cat '{}' ';'
exit 1
Expand Down

0 comments on commit e2aa74e

Please sign in to comment.