소스 검색

Github Build Actions for Pull Requests (#6512)

Github Action will automatically build pull requests on:

OS: Ubuntu 20.04 LTS
GCC: Versions 7, 8, 9 and 10
Both Renewal and Pre-Renewal

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Akkarinage 3 년 전
부모
커밋
6a25a392c2
2개의 변경된 파일92개의 추가작업 그리고 0개의 파일을 삭제
  1. 57 0
      .github/workflows/build_servers.yml
  2. 35 0
      tools/ci/import_sql.sh

+ 57 - 0
.github/workflows/build_servers.yml

@@ -0,0 +1,57 @@
+name: Build Servers from a Pull Request
+# build_servers.yml
+
+on:
+  pull_request:
+    paths:
+      # This workflow should run when a file in the src/ directory has been modified.
+      - 'src/**'
+      - '3rdparty/**'
+
+jobs:
+  build:
+    # Github Actions checks for '[ci skip]', '[skip ci]', '[no ci]', '[skip actions]', or '[actions skip]' but not a hyphenated version.
+    # It's a catch-all incase a Pull Request has been opened and someone is on auto-pilot.
+    if: "!contains(github.event.head_commit.message, 'ci-skip')"
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+          # The ubuntu-latest label currently points to ubuntu-18.04.
+          # Available: ubuntu-20.04, ubuntu-18.04	
+          os: [ubuntu-latest]
+          # Older versions of GCC are not available via unaltered aptitude repo lists.
+          gcc: ['7', '8', '9', '10']
+          # We run build checks for both Renewal and PRE-Renewal
+          mode: ['PRE', 'RE']
+          # This workflow currently does not run different jobs for VIP enabled/disabled. That would be a waste of time.
+
+    steps:
+      - uses: actions/checkout@v2
+      
+      # A simple 'yes' and 'no' can be confusing, so we use names to display in the current job then convert them for use in the compiler.
+      - name: Variable Parsing - PRE
+        if: ${{ matrix.mode == 'PRE' }} 
+        run: |
+          echo "PRERE=yes" >> $GITHUB_ENV
+      - name: Variable Parsing - RE
+        if: ${{ matrix.mode == 'RE' }} 
+        run: |
+          echo "PRERE=no" >> $GITHUB_ENV
+
+      - name: Update & Install packages
+        # Ubuntu runners already have most of the packages rAthena requires to build.
+        # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
+        run: |
+          sudo apt update
+          sudo apt install zlib1g-dev libpcre3-dev gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
+          
+      - name: Command - configure
+        env:
+            CONFIGURE_FLAGS: 'CC=gcc-${{ matrix.gcc }} CXX=g++-${{ matrix.gcc }} --enable-prere=${{ env.PRERE }} --enable-buildbot=yes'
+        run: ./configure $CONFIGURE_FLAGS
+      
+      - name: Command - make clean
+        run: make clean
+
+      - name: Command - make server
+        run: make server

+ 35 - 0
tools/ci/import_sql.sh

@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+# import_sql.sh
+# This file is used by Github Actions
+
+function aborterror {
+	echo $@
+	exit 1
+}
+
+DB_ROOT=root
+DB_ROOTPW=root
+DB_NAME=ragnarok
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/main.sql || aborterror "Unable to import main database."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/logs.sql || aborterror "Unable to import logs database."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_cash_db.sql || aborterror "Unable to import cash item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_cash_db2.sql || aborterror "Unable to import cash item 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db.sql || aborterror "Unable to import pre-renewal item table structure."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_usable.sql || aborterror "Unable to import pre-renewal usable item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_equip.sql || aborterror "Unable to import pre-renewal equip item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_etc.sql || aborterror "Unable to import pre-renewal etc item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db2.sql || aborterror "Unable to import pre-renewal item 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_re.sql || aborterror "Unable to import renewal item table structure."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_re_usable.sql || aborterror "Unable to import renewal usable item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_re_equip.sql || aborterror "Unable to import renewal equip item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db_re_etc.sql || aborterror "Unable to import renewal etc item table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/item_db2_re.sql || aborterror "Unable to import renewal item 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_db.sql || aborterror "Unable to import pre-renewal monster table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_db2.sql || aborterror "Unable to import pre-renewal monster 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_db_re.sql || aborterror "Unable to import renewal monster table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_db2_re.sql || aborterror "Unable to import renewal monster 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_skill_db.sql || aborterror "Unable to import pre-renewal monster skill table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_skill_db2.sql || aborterror "Unable to import pre-renewal monster skill 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_skill_db_re.sql || aborterror "Unable to import renewal monster skill table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/mob_skill_db2_re.sql || aborterror "Unable to import renewal monster skill 2 table."
+mysql -u $DB_ROOT -p$DB_ROOTPW $DB_NAME < sql-files/roulette_default_data.sql || aborterror "Unable to import roulette table."