Skip to content

Commit

Permalink
Merge branch 'triplea-game:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tjrbrom authored Apr 20, 2022
2 parents aed46ab + 9fae763 commit 356374e
Show file tree
Hide file tree
Showing 1,050 changed files with 17,666 additions and 13,246 deletions.
2 changes: 1 addition & 1 deletion .build/build-installer
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function install_install4j() {

echo "Downloading and installing install4j to '$INSTALL4J_HOME'"
wget --no-verbose -O install4j_unix.sh \
https://raw.githubusercontent.com/triplea-game/assets/master/install4j/install4j_unix_8_0_7.sh
https://raw.githubusercontent.com/triplea-game/assets/master/install4j/install4j_linux-x64_9_0_5.sh
chmod +x install4j_unix.sh
./install4j_unix.sh -q -dir "$INSTALL4J_HOME"
"$INSTALL4J_HOME/bin/install4jc" -L "$INSTALL4J_LICENSE"
Expand Down
7 changes: 6 additions & 1 deletion .build/check-links-and-yaml-syntax/check-links
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ set -eu
URI_FILE=$(find . -type f -path "*/src/main/java/*" -name "UrlConstants.java")
green="\e[32m"
end="\e[0m"
IGNORE_LIST=("https://www.axisandallies.org/forums" "https://forums.triplea-game.org/")
IGNORE_LIST=(
"https://www.axisandallies.org/forums"
"https://forums.triplea-game.org/"
"https://prod2-lobby.triplea-game.org"
"https://prerelease.triplea-game.org"
)

if [ -z "$URI_FILE" ]; then
echo "Error could not find file 'UrlConstants.java'"
Expand Down
17 changes: 1 addition & 16 deletions .build/code-convention-checks/check-custom-style
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trap 'rm $javaFiles $sqlFiles' EXIT

find . -type f -name "*.java" > "$javaFiles"
find . -type f -name "*Test.java" > "$testFiles"
find servers/database/src/main/resources -type f -name "*.sql" > "$sqlFiles"
find spitfire-server/database/src/main/resources -type f -name "*.sql" > "$sqlFiles"

status=0

Expand All @@ -31,7 +31,6 @@ function main() {
removeUnusedLogAnnotations
#preferSlf4jOverJavaLogging
databaseNamesAreLowerSnakeCase
databaseTablesAreSingular
noTabsInSql
useEmptyOverSizeEqualsZero
useStaticImportsInTest
Expand Down Expand Up @@ -126,20 +125,6 @@ function databaseNamesAreLowerSnakeCase() {
displayResult "$found"
}


function databaseTablesAreSingular() {
title "Database tables should be singular"
example "instead of 'create table words' use 'create table word'"
local found=0

while read -r file; do
grep --color=auto -H -E -i "create table.*s$" "$file" && status=1 && found=1
done <<< "$(cat "$sqlFiles")"


displayResult "$found"
}

function noTabsInSql() {
title "Use spaces in SQL and not tabs"
local found=0
Expand Down
2 changes: 1 addition & 1 deletion .build/code-convention-checks/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -eEux
set -eEu

script_dir=$(dirname "$0")
"$script_dir/check-custom-style"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ bold="\e[1m"

status=0

dbunit_project="servers/lobby-server"

for dbunit_project in "spitfire-server/lobby-module" "spitfire-server/maps-module"; do

## Loop over all .yml dataset files
while read -r dataSetFilePath; do
Expand Down Expand Up @@ -43,6 +44,7 @@ done <<< "$(find "${dbunit_project}/src/test/resources/datasets" -type f -name "
if [ "$status" -eq 1 ]; then
echo -e "${bold}Found unused db-unit test data files. Delete these files or use them in a dbunit test.${normal}"
fi
done

exit "$status"

12 changes: 6 additions & 6 deletions .build/setup-database
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -eux

function main() {
export PGPASSWORD=postgres
createDatabase "lobby_db" "lobby_user" "lobby"
./gradlew flywayMigrateAll
}

function createDatabase() {
local dbName="$1"
Expand All @@ -12,9 +17,4 @@ function createDatabase() {
echo "create database ${dbName} owner ${dbUser}" | psql -h localhost -U postgres -d postgres
}

export PGPASSWORD=postgres
createDatabase "lobby_db" "lobby_user" "lobby"
createDatabase "maps_db" "maps_user" "maps"

./gradlew flywayMigrateAll

main
10 changes: 6 additions & 4 deletions .build/smoke-testing/run
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set -eux

readonly VERSION=$(sed 's/version\s*=\s*//' game-app/game-core/src/main/resources/META-INF/triplea/product.properties)

readonly LOBBY_SERVER_JAR_PATH="servers/lobby-server/build/libs/triplea-lobby-server-${VERSION}.jar"
readonly LOBBY_SERVER_JAR_PATH="spitfire-server/dropwizard-server/build/libs/triplea-dropwizard-server-${VERSION}.jar"
readonly BOT_JAR_PATH="game-app/game-headless/build/libs/triplea-game-headless-${VERSION}.jar"
readonly SMOKE_TEST_JAR_PATH="smoke-testing/build/libs/triplea-smoke-testing-${VERSION}.jar"

Expand Down Expand Up @@ -58,14 +58,16 @@ function printLogs() {


function buildJars() {
./gradlew --parallel \
:servers:lobby-server:shadowJar \
./gradlew \
:spitfire-server:dropwizard-server:shadowJar \
:game-app:game-headless:shadowJar \
:smoke-testing:shadowJar
}

function startLobby() {
java -jar "$LOBBY_SERVER_JAR_PATH" server ./servers/lobby-server/configuration.yml > "$LOBBY_SERVER_OUTPUT" 2>&1 &
java -jar "$LOBBY_SERVER_JAR_PATH" \
server ./spitfire-server/dropwizard-server/configuration.yml \
> "$LOBBY_SERVER_OUTPUT" 2>&1 &
echo $!
}

Expand Down
19 changes: 15 additions & 4 deletions .build/unit-testing/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@
set -u

function main() {
set -x
.build/setup-database
./gradlew --quiet test jacocoTestReport --exclude-task :smoke-testing:test
./gradlew test jacocoTestReport \
--exclude-task :smoke-testing:test \
--exclude-task :spitfire-server:lobby-module:test \
--exclude-task :spitfire-server:maps-module:test \
--exclude-task :spitfire-server:dropwizard-server:test
result="$?"
set +x
# Run coverage reports only if tests passed

if [ "$result" = 0 ]; then
./gradlew \
:spitfire-server:lobby-module:test \
:spitfire-server:maps-module:test \
:spitfire-server:dropwizard-server:test

result="$?"
fi

# Run coverage reports only if tests passed
if [ "$result" = 0 ]; then
echo "Uploading test coverage reports"
# upload coverage report to codecov - https://github.com/codecov/example-gradle
Expand Down
2 changes: 2 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ version: "2"
# https://docs.codeclimate.com/docs/maintainability#section-checks
# https://docs.codeclimate.com/docs/advanced-configuration
checks:
return-statements:
enabled: false
argument-count:
config:
threshold: 5
Expand Down
17 changes: 6 additions & 11 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
## Change Summary & Additional Notes

<!-- If multiple commits please summarize the change above. -->

## Testing
<!-- Describe any manual testing performed below. -->

## Screens Shots
<!-- If there are UI updates, include screenshots below -->

## Additional Notes to Reviewer
<!-- Add any additional details that would be helpful to reviewers -->
<!--
- If multiple commits, summarize what has changed
- Mention any manual testing done.
- If there are UI updates, please include before & after screenshots
-->

## Release Note

<!--
Include a release note if there is a bug fix or a visible change for players.
For format & syntax help, see:
Expand Down
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: org.flywaydb.flyway
versions:
- 7.8.0
- dependency-name: com.diffplug.spotless
versions:
- 5.12.0
- dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310
versions:
- 2.12.2
- dependency-name: com.install4j.gradle
versions:
- "9.0"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
29 changes: 0 additions & 29 deletions .github/stale.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check Formatting
on:
push:
branches: master
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Run SpotlessCheck
run: ./gradlew spotlessCheck

2 changes: 1 addition & 1 deletion .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Check Links are Valid
run: .build/check-links-and-yaml-syntax/check-links

2 changes: 1 addition & 1 deletion .github/workflows/check-yaml-syntax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Validate YAML Formatting
run: ./gradlew validateYamls

5 changes: 3 additions & 2 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Run Checkstyle
run: ./gradlew checkstyleMain checkstyleTest
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/codacy-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.

name: Codacy Security Scan

on:
push:
branches: [ master, release/* ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '26 5 * * 1'

jobs:
codacy-security-scan:
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v3

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/[email protected]
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Adjust severity of non-security issues
gh-code-scanning-compat: true
# Force 0 exit code to allow SARIF file generation
# This will handover control about PR rejection to the GitHub side
max-allowed-issues: 2147483647

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/code-convention-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run Code Convention Checks
run: .build/code-convention-checks/run

5 changes: 3 additions & 2 deletions .github/workflows/compatibility-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Run Compatibility Tests
run: ./gradlew :smoke-testing:test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: Ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: set build version variables
run: |
BUILD_NUMBER=$(.build/set-build-number ${{ github.run_number }})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-map-summaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: Ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Update maps on website
run: .build/update-maps-on-website/run
env:
Expand Down
Loading

0 comments on commit 356374e

Please sign in to comment.