2021-09-03 19:13:33 +08:00
|
|
|
# Listens for new PR comments containing !pp check [id], and runs a diffcalc comparison against master.
|
|
|
|
# Usage:
|
|
|
|
# !pp check 0 | Runs only the osu! ruleset.
|
|
|
|
# !pp check 0 2 | Runs only the osu! and catch rulesets.
|
|
|
|
#
|
|
|
|
|
2021-09-03 16:56:56 +08:00
|
|
|
name: Diffcalc Consistency Checks
|
|
|
|
on:
|
|
|
|
issue_comment:
|
|
|
|
types: [ created ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
DB_USER: root
|
|
|
|
DB_HOST: 127.0.0.1
|
2021-09-17 18:47:41 +08:00
|
|
|
DB_PORT: 33306:3306
|
2021-09-03 16:56:56 +08:00
|
|
|
CONCURRENCY: 4
|
|
|
|
ALLOW_DOWNLOAD: 1
|
|
|
|
SAVE_DOWNLOADED: 1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
diffcalc:
|
|
|
|
name: Diffcalc
|
2021-09-17 18:47:41 +08:00
|
|
|
runs-on: self-hosted
|
2021-09-07 14:54:58 +08:00
|
|
|
continue-on-error: true
|
2021-09-03 16:56:56 +08:00
|
|
|
|
2021-09-09 13:42:39 +08:00
|
|
|
if: github.event.issue.pull_request && contains(github.event.comment.body, '!pp check') && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER')
|
2021-09-03 18:12:55 +08:00
|
|
|
|
2021-09-03 16:56:56 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
ruleset:
|
|
|
|
- { name: osu, id: 0 }
|
|
|
|
- { name: taiko, id: 1 }
|
2021-09-09 13:36:49 +08:00
|
|
|
- { name: fruits, id: 2 }
|
2021-09-03 16:56:56 +08:00
|
|
|
- { name: mania, id: 3 }
|
|
|
|
|
|
|
|
services:
|
|
|
|
mysql:
|
|
|
|
image: mysql:8.0
|
|
|
|
env:
|
|
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
|
|
ports:
|
2021-09-17 18:47:41 +08:00
|
|
|
- 33306:3306
|
2021-09-03 16:56:56 +08:00
|
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
|
|
|
|
steps:
|
2021-09-03 19:10:17 +08:00
|
|
|
- name: Verify ruleset
|
|
|
|
if: contains(github.event.comment.body, matrix.ruleset.id) == false
|
|
|
|
run: |
|
|
|
|
echo "${{ github.event.comment.body }} doesn't contain ${{ matrix.ruleset.id }}"
|
|
|
|
exit 1
|
|
|
|
|
2021-09-03 16:56:56 +08:00
|
|
|
- name: Verify MySQL connection from host
|
|
|
|
run: |
|
2021-09-17 18:47:41 +08:00
|
|
|
mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "SHOW DATABASES"
|
2021-09-03 16:56:56 +08:00
|
|
|
|
|
|
|
- name: Create directory structure
|
|
|
|
run: |
|
|
|
|
mkdir -p $GITHUB_WORKSPACE/master/
|
|
|
|
mkdir -p $GITHUB_WORKSPACE/pr/
|
|
|
|
|
|
|
|
# Checkout osu
|
|
|
|
- name: Checkout osu (master)
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2021-09-20 22:18:31 +08:00
|
|
|
repository: peppy/osu
|
|
|
|
ref: 'diffcalc-optimisations'
|
2021-09-03 16:56:56 +08:00
|
|
|
path: 'master/osu'
|
|
|
|
- name: Checkout osu (pr)
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: 'pr/osu'
|
|
|
|
|
|
|
|
# Checkout osu-difficulty-calculator
|
|
|
|
- name: Checkout osu-difficulty-calculator (master)
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: ppy/osu-difficulty-calculator
|
|
|
|
path: 'master/osu-difficulty-calculator'
|
|
|
|
- name: Checkout osu-difficulty-calculator (pr)
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: ppy/osu-difficulty-calculator
|
|
|
|
path: 'pr/osu-difficulty-calculator'
|
|
|
|
|
|
|
|
- name: Install .NET 5.0.x
|
|
|
|
uses: actions/setup-dotnet@v1
|
|
|
|
with:
|
|
|
|
dotnet-version: "5.0.x"
|
|
|
|
|
|
|
|
# Sanity checks to make sure diffcalc is not run when incompatible.
|
|
|
|
- name: Build diffcalc (master)
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE/master/osu-difficulty-calculator
|
|
|
|
./UseLocalOsu.sh
|
|
|
|
dotnet build
|
|
|
|
- name: Build diffcalc (pr)
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE/pr/osu-difficulty-calculator
|
|
|
|
./UseLocalOsu.sh
|
|
|
|
dotnet build
|
|
|
|
|
|
|
|
# Initial data imports
|
|
|
|
- name: Download + import data
|
|
|
|
run: |
|
2021-09-14 11:18:19 +08:00
|
|
|
PERFORMANCE_DATA_NAME=$(curl https://data.ppy.sh/ | grep performance_${{ matrix.ruleset.name }}_top_1000 | tail -1 | awk -F "\"" '{print $2}' | sed 's/\.tar\.bz2//g')
|
2021-09-03 17:10:16 +08:00
|
|
|
BEATMAPS_DATA_NAME=$(curl https://data.ppy.sh/ | grep osu_files | tail -1 | awk -F "\"" '{print $2}' | sed 's/\.tar\.bz2//g')
|
2021-09-03 16:56:56 +08:00
|
|
|
|
|
|
|
# Set env variable for further steps.
|
|
|
|
echo "BEATMAPS_PATH=$GITHUB_WORKSPACE/$BEATMAPS_DATA_NAME" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
|
|
|
|
wget https://data.ppy.sh/$PERFORMANCE_DATA_NAME.tar.bz2
|
|
|
|
wget https://data.ppy.sh/$BEATMAPS_DATA_NAME.tar.bz2
|
|
|
|
tar -xf $PERFORMANCE_DATA_NAME.tar.bz2
|
|
|
|
tar -xf $BEATMAPS_DATA_NAME.tar.bz2
|
|
|
|
|
|
|
|
cd $GITHUB_WORKSPACE/$PERFORMANCE_DATA_NAME
|
|
|
|
|
2021-09-17 18:47:41 +08:00
|
|
|
mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "CREATE DATABASE osu_master"
|
|
|
|
mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "CREATE DATABASE osu_pr"
|
2021-09-03 16:56:56 +08:00
|
|
|
|
2021-09-14 11:46:27 +08:00
|
|
|
echo "Importing SQL..."
|
2021-09-17 18:47:41 +08:00
|
|
|
{ pv -f *.sql | mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} --database=osu_master; } 2>&1 | stdbuf -oL tr '\r' '\n'
|
|
|
|
{ pv -f *.sql | mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} --database=osu_pr; } 2>&1 | stdbuf -oL tr '\r' '\n'
|
2021-09-03 16:56:56 +08:00
|
|
|
|
|
|
|
# Run diffcalc
|
|
|
|
- name: Run diffcalc (master)
|
|
|
|
env:
|
|
|
|
DB_NAME: osu_master
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE/master/osu-difficulty-calculator/osu.Server.DifficultyCalculator
|
|
|
|
dotnet run -c:Release -- all -m ${{ matrix.ruleset.id }} -ac -c ${{ env.CONCURRENCY }}
|
|
|
|
- name: Run diffcalc (pr)
|
|
|
|
env:
|
|
|
|
DB_NAME: osu_pr
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE/pr/osu-difficulty-calculator/osu.Server.DifficultyCalculator
|
|
|
|
dotnet run -c:Release -- all -m ${{ matrix.ruleset.id }} -ac -c ${{ env.CONCURRENCY }}
|
|
|
|
|
|
|
|
# Print diffs
|
|
|
|
- name: Print diffs
|
|
|
|
run: |
|
2021-09-17 18:47:41 +08:00
|
|
|
mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "
|
2021-09-03 16:56:56 +08:00
|
|
|
SELECT
|
|
|
|
m.beatmap_id,
|
|
|
|
m.mods,
|
2021-09-16 13:24:30 +08:00
|
|
|
b.filename,
|
2021-09-03 18:23:55 +08:00
|
|
|
m.diff_unified as 'sr_master',
|
|
|
|
p.diff_unified as 'sr_pr',
|
|
|
|
(p.diff_unified - m.diff_unified) as 'diff'
|
2021-09-03 16:56:56 +08:00
|
|
|
FROM osu_master.osu_beatmap_difficulty m
|
|
|
|
JOIN osu_pr.osu_beatmap_difficulty p
|
|
|
|
ON m.beatmap_id = p.beatmap_id
|
|
|
|
AND m.mode = p.mode
|
|
|
|
AND m.mods = p.mods
|
2021-09-16 13:24:30 +08:00
|
|
|
JOIN osu_pr.osu_beatmaps b
|
|
|
|
ON b.beatmap_id = p.beatmap_id
|
2021-09-03 16:56:56 +08:00
|
|
|
WHERE abs(m.diff_unified - p.diff_unified) > 0.1
|
|
|
|
ORDER BY abs(m.diff_unified - p.diff_unified)
|
2021-09-06 15:53:09 +08:00
|
|
|
DESC
|
|
|
|
LIMIT 10000;"
|
2021-09-03 16:56:56 +08:00
|
|
|
|
2021-09-18 02:49:30 +08:00
|
|
|
# Todo: Run ppcalc
|