Migrates from Travis CI To Actions (#14958)

* Migrates from Travis CI To Actions

First hitch

Surprise surprise NanoUI is the issue

...

Please work

Final Commit

* Undoes an oops
This commit is contained in:
AffectedArc07
2020-11-21 16:08:50 +00:00
committed by GitHub
parent 3613057b9d
commit 841f56fe83
28 changed files with 138 additions and 172 deletions

3
.github/CODEOWNERS vendored
View File

@@ -11,8 +11,7 @@
# CI + Tooling
/.github/workflows/ @AffectedArc07
/code/modules/unit_tests/ @AffectedArc07
/tools/travis/ @AffectedArc07
.travis.yml @AffectedArc07
/tools/ci/ @AffectedArc07
# Executables that need to be security-cleared
dreamchecker.exe @AffectedArc07

View File

@@ -597,8 +597,8 @@ pull requests/issues, and merging/closing pull requests.
matter how trivial. This is to ensure quality.
* A subset of this instruction: Do not push directly to the repository, always make a
pull request.
* Wait for the Travis CI build to complete. If it fails, the pull request may only be
merged if there is a very good reason (example: fixing the Travis configuration).
* Wait for the CI build to complete. If it fails, the pull request may only be
merged if there is a very good reason (example: fixing the CI configuration).
* Pull requests labeled as bugfixes and refactors may be merged as soon as they are
reviewed.
* The shortest waiting period for -any- feature or balancing altering pull request is 24

87
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
name: CI
on:
pull_request:
branches:
- master
jobs:
run_linters:
name: Run Linters
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Cache
uses: actions/cache@v2
with:
path: $HOME/SpacemanDMM
key: ${{ runner.os }}-spacemandmm
- name: Install Tools
run: |
bash tools/ci/install_build_deps.sh
bash tools/ci/install_dreamchecker.sh
- name: Run Linters
run: |
find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/ci/json_verifier.py
tools/ci/build_nanoui.sh
tools/ci/build_tgui.sh
tools/ci/check_grep.sh
python3 tools/ci/check_line_endings.py
~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1
- name: Annotate Lints
uses: yogstation13/DreamAnnotate@v1
if: always()
with:
outputFile: output-annotations.txt
compile_all_maps:
name: Compile All Maps
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Cache
uses: actions/cache@v2
with:
path: $HOME/BYOND
key: ${{ runner.os }}-byond
- name: Compile All Maps
run: |
tools/ci/install_byond.sh
source $HOME/BYOND/byond/bin/byondsetup
tools/ci/generate_maplist.sh
tools/ci/dm.sh -Mci_map_testing paradise.dme
unit_tests_and_sql:
name: Unit Tests + SQL Validation
runs-on: ubuntu-18.04
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
steps:
- uses: actions/checkout@v2
- name: Setup Cache
uses: actions/cache@v2
with:
path: $HOME/BYOND
key: ${{ runner.os }}-byond
- name: Setup & Validate DB
run: |
sudo systemctl start mysql
python3 tools/ci/generate_sql_scripts.py
tools/ci/validate_sql.sh
- name: Install RUST_G
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install libssl1.1:i386
bash tools/ci/install_rustg.sh
- name: Compile & Run Unit Tests
run: |
tools/ci/install_byond.sh
tools/ci/install_rustg.sh
source $HOME/BYOND/byond/bin/byondsetup
tools/ci/dm.sh -DCIBUILDING paradise.dme
tools/ci/run_server.sh

View File

@@ -1,73 +0,0 @@
language: generic
dist: bionic
os: linux
git:
depth: 1
jobs:
include:
- name: "Run Linters"
addons:
apt:
packages:
- python3
- python3-pip
- python3-setuptools
install:
- tools/travis/install_build_deps.sh
- tools/travis/install_dreamchecker.sh
script:
- find . -name "*.php" -print0 | xargs -0 -n1 php -l
- find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/travis/json_verifier.py
- tools/travis/build_nanoui.sh
- tools/travis/build_tgui.sh
- tools/travis/check_grep.sh
- python3 tools/travis/check_line_endings.py
- ~/dreamchecker
- name: "Compile All Maps"
addons:
apt:
packages:
- libstdc++6:i386
cache:
directories:
- $HOME/BYOND
install:
- tools/travis/install_byond.sh
- source $HOME/BYOND/byond/bin/byondsetup
script:
- tools/travis/generate_maplist.sh
- tools/travis/dm.sh -Mtravis_map_testing paradise.dme
- name: "Unit Tests + SQL Validation"
addons:
mariadb: '10.2'
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- python3
- libstdc++6:i386
- gcc-multilib
- pkg-config:i386
- zlib1g-dev:i386
- libssl1.1:i386
cache:
directories:
- $HOME/.cargo
- $HOME/.rustup
- $HOME/BYOND
before_install:
- 'sudo apt-get -qq update'
install:
- tools/travis/install_byond.sh
- tools/travis/install_rustg.sh
- source $HOME/BYOND/byond/bin/byondsetup
- python3 tools/travis/generate_sql_scripts.py
before_script:
- tools/travis/validate_sql.sh
script:
- tools/travis/dm.sh -DTRAVISBUILDING paradise.dme || travis_terminate 1
- tools/travis/run_server.sh

View File

@@ -1,5 +1,4 @@
# Paradise
[![Build Status](https://travis-ci.org/ParadiseSS13/Paradise.svg?branch=master)](https://travis-ci.org/ParadiseSS13/Paradise)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/paradisess13/paradise.svg)](http://isitmaintained.com/project/paradisess13/paradise "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/paradisess13/paradise.svg)](http://isitmaintained.com/project/paradisess13/paradise "Percentage of issues still open")
![Render Nanomaps](https://github.com/ParadiseSS13/Paradise/workflows/Render%20Nanomaps/badge.svg)

View File

@@ -3,8 +3,6 @@
export SPACEMANDMM_TAG=suite-1.6
# For NanoUI + TGUI
export NODE_VERSION=12
# For the scripts in tools
export PHP_VERSION=7.2
# Byond Major
export BYOND_MAJOR=513
# Byond Minor

View File

@@ -1,9 +0,0 @@
version: '{build}'
skip_branch_with_pr: true
shallow_clone: true
build_script:
- ps: ./tools/appveyor/build.ps1
- ps: "$deployPath = $env:APPVEYOR_BUILD_FOLDER + '/deploy'; bash ./tools/appveyor/deploy.sh $deployPath"
- ps: "[System.IO.Compression.ZipFile]::CreateFromDirectory($env:APPVEYOR_BUILD_FOLDER + '/deploy', $env:APPVEYOR_BUILD_FOLDER + '/deploy.zip')"
artifacts:
- path: deploy.zip

View File

@@ -5,7 +5,7 @@
// #define UNIT_TESTS
#ifdef TRAVISBUILDING
#ifdef CIBUILDING
#define UNIT_TESTS
#endif

View File

@@ -1,9 +1,9 @@
// Unit test to check SQL version has been updated properly.,
/datum/unit_test/sql_version/Run()
// Check if the SQL version set in the code is equal to the travis DB config
// Check if the SQL version set in the code is equal to the CI DB config
if(config.sql_enabled && sql_version != SQL_VERSION)
Fail("SQL version error: Game is running V[SQL_VERSION] but config is V[sql_version]. You may need to update tools/travis/dbconfig.txt")
// Check if the travis DB config is up to date with the example dbconfig
Fail("SQL version error: Game is running V[SQL_VERSION] but config is V[sql_version]. You may need to update tools/ci/dbconfig.txt")
// Check if the CI DB config is up to date with the example dbconfig
// This proc is a little unclean but it works
var/example_db_version
var/list/Lines = file2list("config/example/dbconfig.txt")

View File

@@ -1,12 +0,0 @@
$BYOND_MAJOR=512
$BYOND_MINOR=1427
if(!(Test-Path -Path "C:/byond")){
Invoke-WebRequest "http://www.byond.com/download/build/$BYOND_MAJOR/$BYOND_MAJOR.${BYOND_MINOR}_byond.zip" -o C:/byond.zip
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:/byond.zip", "C:/")
Remove-Item C:/byond.zip
}
Set-Location $env:APPVEYOR_BUILD_FOLDER
&"C:/byond/bin/dm.exe" -max_errors 0 paradise.dme
exit $LASTEXITCODE

View File

@@ -1,21 +0,0 @@
#First arg is path to where you want to deploy
#creates a work tree free of everything except what's necessary to run the game
mkdir -p \
$1/_maps \
$1/config \
$1/goon \
$1/strings \
if [ -d ".git" ]; then
# Control will enter here if $DIRECTORY exists.
mkdir -p $1/.git/logs
cp -r .git/logs/* $1/.git/logs/
fi
cp paradise.dmb paradise.rsc rust_g.dll $1/
cp -r _maps/* $1/_maps/
cp -r config/* $1/config/
cp -r goon/* $1/goon/
cp -r config/example/* $1/config/
cp -r strings/* $1/strings/

View File

@@ -1,6 +1,6 @@
# Info
All scripts utilised by Travis CI should be placed into this folder for the sake of maintainability, and knowing where stuff is
All scripts utilised by CI should be placed into this folder for the sake of maintainability, and knowing where stuff is
# NOTE
Do not move the `dm.sh` script without **VERY** good reason, as the server backend relies on it for updating, and moving this file **WILL** break server updating, but make the server appear to still be updated. TLDR: Dont move it or break its existing functionality, without advancing changes to the server host.

View File

@@ -3,7 +3,6 @@ set -euo pipefail
cd nano
source ~/.nvm/nvm.sh
npm install -g gulp-cli
npm install --loglevel=error
node node_modules/gulp/bin/gulp.js --require less-loader
cd ..

View File

@@ -1,4 +1,4 @@
# This exists solely as a DBconfig file for travis testing
# This exists solely as a DBconfig file for CI testing
# Dont use it ingame
# Remember to update this when you increase the SQL version! -aa
SQL_ENABLED
@@ -7,5 +7,5 @@ ADDRESS 127.0.0.1
PORT 3306
FEEDBACK_DATABASE feedback
FEEDBACK_TABLEPREFIX
FEEDBACK_LOGIN travis_sql
FEEDBACK_LOGIN ci_sql
FEEDBACK_PASSWORD not_a_strong_password

9
tools/ci/generate_maplist.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
set -euo pipefail
# This script loops through every subdir here to generate a list of all maps programatically to avoid the list getting out of date
cd _maps
find | grep -Ei ".dmm" | grep -v -e ".before" -e ".backup" > ci_map_testing.dm
sed -i -e 's/.*/#include \"&\"/' ci_map_testing.dm
echo "Generated map compile file with `wc -l ci_map_testing.dm` maps"

View File

@@ -26,11 +26,11 @@ os.chdir("../../")
# Delete the testing directory IF it exists.
# This is what I mean by python being picky
if os.path.exists("tools/travis/sql_tmp") and os.path.isdir("tools/travis/sql_tmp"):
shutil.rmtree("tools/travis/sql_tmp")
if os.path.exists("tools/ci/sql_tmp") and os.path.isdir("tools/ci/sql_tmp"):
shutil.rmtree("tools/ci/sql_tmp")
# Now make the dir
os.mkdir("tools/travis/sql_tmp")
os.mkdir("tools/ci/sql_tmp")
# These lines will be used to generate a file which runs all the SQL scripts
# First we test from schema 0 all the way up to latest
@@ -39,7 +39,7 @@ os.mkdir("tools/travis/sql_tmp")
scriptLines = [
"#!/bin/bash\n",
"set -euo pipefail\n"
"mysql -u root < tools/travis/sql_v0.sql\n"
"mysql -u root -proot < tools/ci/sql_v0.sql\n"
]
# And write the files and tell them to be used
@@ -51,23 +51,23 @@ for file in orderedSqlFiles:
fileLines.insert(0, "USE `feedback`;\n")
# Write new files to be used by the testing script
outFile = open("tools/travis/sql_tmp/" + file, "w+")
outFile = open("tools/ci/sql_tmp/" + file, "w+")
outFile.writelines(fileLines)
outFile.close()
# Add a line to the script being made that tells it to use this SQL file
scriptLines.append("mysql -u root < tools/travis/sql_tmp/" + str(file) + "\n")
scriptLines.append("mysql -u root -proot < tools/ci/sql_tmp/" + str(file) + "\n")
scriptLines.append("mysql -u root -e 'DROP DATABASE feedback;'\n")
scriptLines.append("mysql -u root < SQL/paradise_schema_prefixed.sql\n")
scriptLines.append("mysql -u root -e 'DROP DATABASE feedback;'\n")
scriptLines.append("mysql -u root < SQL/paradise_schema.sql\n")
scriptLines.append("mysql -u root -e 'GRANT ALL on feedback.* TO `travis_sql`@`127.0.0.1` IDENTIFIED BY \"not_a_strong_password\";'\n")
scriptLines.append("mysql -u root -proot -e 'DROP DATABASE feedback;'\n")
scriptLines.append("mysql -u root -proot < SQL/paradise_schema_prefixed.sql\n")
scriptLines.append("mysql -u root -proot -e 'DROP DATABASE feedback;'\n")
scriptLines.append("mysql -u root -proot < SQL/paradise_schema.sql\n")
scriptLines.append("mysql -u root -proot -e 'GRANT ALL on feedback.* TO `ci_sql`@`127.0.0.1` IDENTIFIED BY \"not_a_strong_password\";'\n")
outputScript = open("tools/travis/validate_sql.sh", "w+")
outputScript = open("tools/ci/validate_sql.sh", "w+")
outputScript.writelines(scriptLines)
outputScript.close()
st = os.stat('tools/travis/validate_sql.sh')
os.chmod('tools/travis/validate_sql.sh', st.st_mode | stat.S_IEXEC)
st = os.stat('tools/ci/validate_sql.sh')
os.chmod('tools/ci/validate_sql.sh', st.st_mode | stat.S_IEXEC)
print("SQL validation script written successfully")

View File

@@ -8,4 +8,3 @@ nvm install $NODE_VERSION
nvm use $NODE_VERSION
npm install --global yarn
phpenv global $PHP_VERSION

View File

@@ -5,7 +5,7 @@ cp config/example/* config/
#Apply test DB config for SQL connectivity
rm config/dbconfig.txt
cp tools/travis/dbconfig.txt config
cp tools/ci/dbconfig.txt config
# Now run the server and the unit tests
DreamDaemon paradise.dmb -close -trusted -verbose

View File

@@ -1,5 +1,5 @@
# This file is revision 0 of the server SQL schema
# It is intended ONLY for travis testing, and thus has data thrown in to test all update files with
# It is intended ONLY for CI testing, and thus has data thrown in to test all update files with
# DO NOT SET THIS AS THE GAMES PROPER SCHEMA OR A LOT OF STUFF WILL BREAK
-- --------------------------------------------------------
@@ -459,7 +459,7 @@ CREATE TABLE IF NOT EXISTS `poll_textreply` (
-- Dumping data for table feedback.poll_textreply: ~0 rows (approximately)
/*!40000 ALTER TABLE `poll_textreply` DISABLE KEYS */;
INSERT INTO `poll_textreply` (`id`, `datetime`, `pollid`, `ckey`, `ip`, `replytext`, `adminrank`) VALUES
(1, '2020-04-24 18:05:42', 1, 'AffectedArc07', '127.0.0.1', 'This is far too much work for a travis rework', 'Player');
(1, '2020-04-24 18:05:42', 1, 'AffectedArc07', '127.0.0.1', 'This is far too much work for a CI rework', 'Player');
/*!40000 ALTER TABLE `poll_textreply` ENABLE KEYS */;
-- Dumping structure for table feedback.poll_vote

View File

@@ -1,9 +0,0 @@
#!/bin/bash
set -euo pipefail
# This script loops through every subdir here to generate a list of all maps programatically to avoid the list getting out of date
cd _maps
find | grep -Ei ".dmm" | grep -v -e ".before" -e ".backup" > travis_map_testing.dm
sed -i -e 's/.*/#include \"&\"/' travis_map_testing.dm
echo "Generated map compile file with `wc -l travis_map_testing.dm` maps"