Skip to content

Commit

Permalink
Adding github actions workflows for macos x64 and ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
Asheraf committed Feb 10, 2024
1 parent 1c386f5 commit d3db3f2
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 42 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,11 @@ jobs:
needs: build
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/mysql.yml
macos_latest:
needs: build
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/macos_latest.yml
macos_m1:
needs: build
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/macos_m1.yml
81 changes: 81 additions & 0 deletions .github/workflows/macos_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: macos_latest

on: workflow_call

env:
MYSQL_DATABASE: 'ragnarok'
MYSQL_USER: 'ragnarok'
MYSQL_PASSWORD: 'ragnarok'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MACOS_COMMON_PACKAGES: make zlib pcre mysql mysql-client mysql-connector-c
SQLHOST: 'localhost'

jobs:
build:
runs-on: macos-latest
timeout-minutes: 60
strategy:
matrix:
CC: [clang]
RENEWAL: ["", "--disable-renewal"]
CLIENT_TYPE: ["", "--enable-packetver-re", "--enable-packetver-zero"]
HTTPLIB: ["", "--with-http_parser=llhttp"]
SANITIZER: ["--disable-manager", "--disable-manager --enable-sanitize=full"]
PACKET_VERSION: ["--enable-packetver=20221024", "--enable-packetver=20130724"]
exclude:
- PACKET_VERSION: "--enable-packetver=20130724"
CLIENT_TYPE: "--enable-packetver-zero"

# github.head_ref will stop previous runs in the same PR (if in a PR)
# github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop)
concurrency:
group: macos-x64-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.HTTPLIB }}_${{ matrix.SANITIZER }}_${{ matrix.PACKET_VERSION}}
cancel-in-progress: true

env:
CC: ${{ matrix.CC }}
CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }}
PACKET_VERSION: ${{ matrix.PACKET_VERSION }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: info
run: |
uname -a
- name: prepare the build environment
run: |
echo "CPPFLAGS=-I$(brew --prefix)/include" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix)/lib" >> $GITHUB_ENV
- name: install packages
run: |
brew update || true
./tools/ci/retry.sh brew install $MACOS_COMMON_PACKAGES
- name: setup mysql server
run: |
brew services start mysql
./tools/ci/retry.sh mysqladmin ping --silent
./tools/ci/travis.sh createdb $MYSQL_DATABASE root
./tools/ci/travis.sh adduser $MYSQL_DATABASE $MYSQL_USER $MYSQL_PASSWORD root '' $SQLHOST
./tools/ci/travis.sh importdb $MYSQL_DATABASE root
- name: get plugins
run: |
./tools/ci/travis.sh getplugins || true
- name: build
run: |
./tools/ci/travis.sh build $CONFIGURE_FLAGS --with-mysql=$(brew --prefix mysql)/bin/mysql_config
- name: test
run: |
./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
- name: extra test
if: env.PACKET_VERSION != '--enable-packetver=20130724'
run: |
./tools/ci/travis.sh extratest
81 changes: 81 additions & 0 deletions .github/workflows/macos_m1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: macos_m1

on: workflow_call

env:
MYSQL_DATABASE: 'ragnarok'
MYSQL_USER: 'ragnarok'
MYSQL_PASSWORD: 'ragnarok'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MACOS_COMMON_PACKAGES: make zlib pcre mysql mysql-client mysql-connector-c
SQLHOST: 'localhost'

jobs:
build:
runs-on: macos-14
timeout-minutes: 60
strategy:
matrix:
CC: [clang]
RENEWAL: ["", "--disable-renewal"]
CLIENT_TYPE: ["", "--enable-packetver-re", "--enable-packetver-zero"]
HTTPLIB: ["", "--with-http_parser=llhttp"]
SANITIZER: ["--disable-manager", "--disable-manager --enable-sanitize=full"]
PACKET_VERSION: ["--enable-packetver=20221024", "--enable-packetver=20130724"]
exclude:
- PACKET_VERSION: "--enable-packetver=20130724"
CLIENT_TYPE: "--enable-packetver-zero"

# github.head_ref will stop previous runs in the same PR (if in a PR)
# github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop)
concurrency:
group: macos-arm-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.HTTPLIB }}_${{ matrix.SANITIZER }}_${{ matrix.PACKET_VERSION}}
cancel-in-progress: true

env:
CC: ${{ matrix.CC }}
CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }}
PACKET_VERSION: ${{ matrix.PACKET_VERSION }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: info
run: |
uname -a
- name: prepare the build environment
run: |
echo "CPPFLAGS=-I$(brew --prefix)/include" >> $GITHUB_ENV
echo "LDFLAGS=-L$(brew --prefix)/lib" >> $GITHUB_ENV
- name: install packages
run: |
brew update || true
./tools/ci/retry.sh brew install $MACOS_COMMON_PACKAGES
- name: setup mysql server
run: |
brew services start mysql
./tools/ci/retry.sh mysqladmin ping --silent
./tools/ci/travis.sh createdb $MYSQL_DATABASE root
./tools/ci/travis.sh adduser $MYSQL_DATABASE $MYSQL_USER $MYSQL_PASSWORD root '' $SQLHOST
./tools/ci/travis.sh importdb $MYSQL_DATABASE root
- name: get plugins
run: |
./tools/ci/travis.sh getplugins || true
- name: build
run: |
./tools/ci/travis.sh build $CONFIGURE_FLAGS --with-mysql=$(brew --prefix mysql)/bin/mysql_config
- name: test
run: |
./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
- name: extra test
if: env.PACKET_VERSION != '--enable-packetver=20130724'
run: |
./tools/ci/travis.sh extratest
167 changes: 140 additions & 27 deletions configure
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac a16c389a2.
# From configure.ac ce12b6b8f.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71.
#
Expand Down Expand Up @@ -1396,38 +1396,39 @@ Optional Features:
--enable-packetver-ad Sets or unsets the PACKETVER_AD define - see
src/common/mmo.h (currently disabled by default)
--enable-epoll use epoll(4) on Linux
--enable-debug[=ARG] Compiles extra debug code. (yes by default)
--enable-debug[=ARG] Compiles extra debug code. (yes by default)
(available options: yes, no, gdb)
--enable-libbacktrace[=ARG]
Compiles with libbacktrace. (no by default -
Compiles with libbacktrace. (no by default -
experimental)
--enable-buildbot[=ARG] (available options: yes, no)
--enable-rdtsc Uses rdtsc as timing source (disabled by default)
Enable it when you've timing issues. (For example:
in conjunction with XEN or Other Virtualization
mechanisms) Note: Please ensure that you've disabled
dynamic CPU-Frequencys, such as power saving
options. (On most modern Dedicated Servers cpufreq
is preconfigured, see your distribution's manual how
to disable it). Furthermore, If your CPU has
built-in CPU-Frequency scaling features (such as
Intel's SpeedStep(R)), do not enable this option.
Recent CPUs (Intel Core or newer) guarantee a fixed
increment rate for their TSC, so it should be safe
to use, but please doublecheck the documentation of
both your CPU and OS before enabling this option.
--enable-rdtsc Uses rdtsc as timing source (disabled by default)
Enable it when you've timing issues. (For
example: in conjunction with XEN or Other
Virtualization mechanisms) Note: Please ensure
that you've disabled dynamic CPU-Frequencys, such as
power saving options. (On most modern Dedicated
Servers cpufreq is preconfigured, see your
distribution's manual how to disable it).
Furthermore, If your CPU has built-in CPU-Frequency
scaling features (such as Intel's SpeedStep(R)), do
not enable this option. Recent CPUs (Intel Core or
newer) guarantee a fixed increment rate for their
TSC, so it should be safe to use, but please
doublecheck the documentation of both your CPU and
OS before enabling this option.
--enable-profiler=ARG Profilers: no, gprof (disabled by default)
--disable-64bit Enforce 32bit output on x86_64 systems.
--enable-lto Enables or Disables Linktime Code Optimization (LTO
is disabled by default)
--enable-static Enables or Disables Statick Linking (STATIC is
--disable-64bit Enforce 32bit output on x86_64 systems.
--enable-lto Enables or Disables Linktime Code Optimization
(LTO is disabled by default)
--enable-static Enables or Disables Statick Linking (STATIC is
disabled by default)
--enable-sanitize[=ARG] Enables sanitizer. (disabled by default) (available
options: yes, no, full)
--enable-Werror Enables -Werror in the compiler flags. (disabled by
default)
--disable-renewal Disable Ragnarok Renewal support (override settings
in src/config/renewal.h)
--enable-sanitize[=ARG] Enables sanitizer. (disabled by default)
(available options: yes, no, full)
--enable-Werror Enables -Werror in the compiler flags. (disabled
by default)
--disable-renewal Disable Ragnarok Renewal support (override
settings in src/config/renewal.h)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Expand Down Expand Up @@ -2540,6 +2541,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu




ac_config_files="$ac_config_files Makefile src/common/Makefile"

ac_config_files="$ac_config_files 3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile 3rdparty/libbacktrace/Makefile 3rdparty/libbacktrace/backtrace-supported.h"
Expand Down Expand Up @@ -5681,6 +5683,9 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
pointers_fit_in_ints="yes"
else $as_nop


fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
if test "$pointers_fit_in_ints" = "no" ; then
Expand All @@ -5700,6 +5705,9 @@ _ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
pointers_fit_in_ints="yes (with -m32)"
else $as_nop


fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
Expand Down Expand Up @@ -10488,6 +10496,103 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext



case $host_os in
Darwin*)

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-deprecated-declarations" >&5
printf %s "checking whether $CC supports -Wno-deprecated-declarations... " >&6; }
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror -Wno-deprecated-declarations"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :

# Recent versions of gcc don't fail if -Wno-foo is not recognized
# (unless there are also other warnings), so we also check for -Wfoo
# which always fails if not supported
CFLAGS="$OLD_CFLAGS -Werror -Wdeprecated-declarations"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
CFLAGS="$OLD_CFLAGS -Wno-deprecated-declarations"
# Optionally, run a test
if test "x" != "x"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC can actually use -Wno-deprecated-declarations" >&5
printf %s "checking whether $CC can actually use -Wno-deprecated-declarations... " >&6; }
CFLAGS="$OLD_CFLAGS -Werror -Wdeprecated-declarations"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not needed but enabled" >&5
printf "%s\n" "not needed but enabled" >&6; }
CFLAGS="$OLD_CFLAGS"

else $as_nop

CFLAGS="$OLD_CFLAGS -Werror -Wno-deprecated-declarations"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
CFLAGS="$OLD_CFLAGS -Wno-deprecated-declarations"

else $as_nop

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
CFLAGS="$OLD_CFLAGS"


fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext


fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

else $as_nop

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
CFLAGS="$OLD_CFLAGS"


fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext

else $as_nop

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
CFLAGS="$OLD_CFLAGS"


fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext


;;
esac

# Certain versions of gcc make -Wshadow completely useless by making it flood
# you with unnecessary warnings <https://lkml.org/lkml/2006/11/28/239>
# Let's check if we can really use it
Expand Down Expand Up @@ -12608,9 +12713,17 @@ then :

CFLAGS="$CFLAGS -DHAVE_EXECINFO"

else $as_nop



fi


else $as_nop



fi

done
Expand Down
Loading

0 comments on commit d3db3f2

Please sign in to comment.