From e3542878045a16a72d0cc0a091c96c42eef8df9c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 9 Sep 2021 14:36:49 +0900 Subject: [PATCH 01/19] Fix incorrect ruleset name --- .github/workflows/test-diffcalc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 4274d01bab..92ca1e1a8b 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -33,7 +33,7 @@ jobs: ruleset: - { name: osu, id: 0 } - { name: taiko, id: 1 } - - { name: catch, id: 2 } + - { name: fruits, id: 2 } - { name: mania, id: 3 } services: From fa374e67e7cc001e77d7c2ff6fd49d1f25167b17 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 9 Sep 2021 14:42:39 +0900 Subject: [PATCH 02/19] Single line condition --- .github/workflows/test-diffcalc.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 92ca1e1a8b..bfa4a3a8a0 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -22,10 +22,7 @@ jobs: runs-on: ubuntu-latest continue-on-error: true - 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') + 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') strategy: fail-fast: false From 0f8e570b845f9266e03defc486c6fa2557ac3dd0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Sep 2021 12:18:19 +0900 Subject: [PATCH 03/19] Use top 1000 data --- .github/workflows/test-diffcalc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index bfa4a3a8a0..0e53bd2c88 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -102,7 +102,7 @@ jobs: # Initial data imports - name: Download + import data run: | - PERFORMANCE_DATA_NAME=$(curl https://data.ppy.sh/ | grep performance_${{ matrix.ruleset.name }}_top | tail -1 | awk -F "\"" '{print $2}' | sed 's/\.tar\.bz2//g') + 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') BEATMAPS_DATA_NAME=$(curl https://data.ppy.sh/ | grep osu_files | tail -1 | awk -F "\"" '{print $2}' | sed 's/\.tar\.bz2//g') # Set env variable for further steps. From fc5fd203d60c75bcc1ec0df3296a23d35e5d6aa3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Sep 2021 12:46:27 +0900 Subject: [PATCH 04/19] Output sql import process --- .github/workflows/test-diffcalc.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 0e53bd2c88..6a8ecbbae5 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -120,8 +120,9 @@ jobs: mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} -e "CREATE DATABASE osu_master" mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} -e "CREATE DATABASE osu_pr" - cat *.sql | mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} --database=osu_master - cat *.sql | mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} --database=osu_pr + echo "Importing SQL..." + { pv -f *.sql | mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} --database=osu_master; } 2>&1 | stdbuf -oL tr '\r' '\n' + { pv -f *.sql | mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} --database=osu_pr; } 2>&1 | stdbuf -oL tr '\r' '\n' # Run diffcalc - name: Run diffcalc (master) From 6bfb31a63559358013447a6ec54609ebb6418112 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Sep 2021 12:55:33 +0900 Subject: [PATCH 05/19] Install pv --- .github/workflows/test-diffcalc.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 6a8ecbbae5..54365ed5f6 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -49,6 +49,9 @@ jobs: echo "${{ github.event.comment.body }} doesn't contain ${{ matrix.ruleset.id }}" exit 1 + - name: Install dependencies + run: sudo apt-get install -y pv + - name: Verify MySQL connection from host run: | sudo apt-get install -y mysql-client From 9d4c5e9cb6bbf12efcc3a866621bbdfe778df1d3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Sep 2021 14:24:30 +0900 Subject: [PATCH 06/19] Add filename to output rows --- .github/workflows/test-diffcalc.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 54365ed5f6..79c1497dca 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -148,6 +148,7 @@ jobs: SELECT m.beatmap_id, m.mods, + b.filename, m.diff_unified as 'sr_master', p.diff_unified as 'sr_pr', (p.diff_unified - m.diff_unified) as 'diff' @@ -156,6 +157,8 @@ jobs: ON m.beatmap_id = p.beatmap_id AND m.mode = p.mode AND m.mods = p.mods + JOIN osu_pr.osu_beatmaps b + ON b.beatmap_id = p.beatmap_id WHERE abs(m.diff_unified - p.diff_unified) > 0.1 ORDER BY abs(m.diff_unified - p.diff_unified) DESC From 06e11484721f9cfa5c58003e9198008bab7387d0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Sep 2021 19:47:41 +0900 Subject: [PATCH 07/19] Run on self-hosted runner --- .github/workflows/test-diffcalc.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 79c1497dca..9c633a597d 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -12,6 +12,7 @@ on: env: DB_USER: root DB_HOST: 127.0.0.1 + DB_PORT: 33306:3306 CONCURRENCY: 4 ALLOW_DOWNLOAD: 1 SAVE_DOWNLOADED: 1 @@ -19,7 +20,7 @@ env: jobs: diffcalc: name: Diffcalc - runs-on: ubuntu-latest + runs-on: self-hosted continue-on-error: true 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') @@ -39,7 +40,7 @@ jobs: env: MYSQL_ALLOW_EMPTY_PASSWORD: yes ports: - - 3306:3306 + - 33306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: @@ -54,8 +55,7 @@ jobs: - name: Verify MySQL connection from host run: | - sudo apt-get install -y mysql-client - mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} -e "SHOW DATABASES" + mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "SHOW DATABASES" - name: Create directory structure run: | @@ -120,12 +120,12 @@ jobs: cd $GITHUB_WORKSPACE/$PERFORMANCE_DATA_NAME - mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} -e "CREATE DATABASE osu_master" - mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} -e "CREATE DATABASE osu_pr" + 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" echo "Importing SQL..." - { pv -f *.sql | mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} --database=osu_master; } 2>&1 | stdbuf -oL tr '\r' '\n' - { pv -f *.sql | mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} --database=osu_pr; } 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_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' # Run diffcalc - name: Run diffcalc (master) @@ -144,7 +144,7 @@ jobs: # Print diffs - name: Print diffs run: | - mysql --host ${{ env.DB_HOST }} -u${{ env.DB_USER }} -e " + mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e " SELECT m.beatmap_id, m.mods, From 6b3a37e262b1da27a58570178946609bbced85c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Sep 2021 03:49:30 +0900 Subject: [PATCH 08/19] Remove deps step --- .github/workflows/test-diffcalc.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 9c633a597d..565af6ad3c 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -50,9 +50,6 @@ jobs: echo "${{ github.event.comment.body }} doesn't contain ${{ matrix.ruleset.id }}" exit 1 - - name: Install dependencies - run: sudo apt-get install -y pv - - name: Verify MySQL connection from host run: | mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "SHOW DATABASES" @@ -164,4 +161,4 @@ jobs: DESC LIMIT 10000;" - # Todo: Run ppcalc \ No newline at end of file + # Todo: Run ppcalc From 1d560ed1226e648d05bc003c6939273f21112b67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Sep 2021 23:18:31 +0900 Subject: [PATCH 09/19] Use optimisation branch for now --- .github/workflows/test-diffcalc.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 565af6ad3c..db1fa7a088 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -63,7 +63,8 @@ jobs: - name: Checkout osu (master) uses: actions/checkout@v2 with: - repository: ppy/osu + repository: peppy/osu + ref: 'diffcalc-optimisations' path: 'master/osu' - name: Checkout osu (pr) uses: actions/checkout@v2 From 7d5e4ae0a2386e82748219bf57d767610d0403de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 18 Sep 2021 03:57:25 +0900 Subject: [PATCH 10/19] Drop service based mysql usage (use host instead) --- .github/workflows/test-diffcalc.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index db1fa7a088..188e074e07 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -12,7 +12,7 @@ on: env: DB_USER: root DB_HOST: 127.0.0.1 - DB_PORT: 33306:3306 + DB_PORT: 3306 CONCURRENCY: 4 ALLOW_DOWNLOAD: 1 SAVE_DOWNLOADED: 1 @@ -34,15 +34,6 @@ jobs: - { name: fruits, id: 2 } - { name: mania, id: 3 } - services: - mysql: - image: mysql:8.0 - env: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - ports: - - 33306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - steps: - name: Verify ruleset if: contains(github.event.comment.body, matrix.ruleset.id) == false @@ -54,6 +45,11 @@ jobs: run: | mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "SHOW DATABASES" + - name: Drop previous databases + run: | + mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "DROP DATABASE IF EXISTS osu_master" + mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "DROP DATABASE IF EXISTS osu_pr" + - name: Create directory structure run: | mkdir -p $GITHUB_WORKSPACE/master/ From 7c2b8fc650f02c25509d8cdf2ebf3db42b6777f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 00:37:12 +0900 Subject: [PATCH 11/19] Apply new skip insert rule --- .github/workflows/test-diffcalc.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 188e074e07..23b5c8bd2c 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -16,6 +16,7 @@ env: CONCURRENCY: 4 ALLOW_DOWNLOAD: 1 SAVE_DOWNLOADED: 1 + SKIP_INSERT_ATTRIBUTES: 1 jobs: diffcalc: @@ -71,12 +72,14 @@ jobs: - name: Checkout osu-difficulty-calculator (master) uses: actions/checkout@v2 with: - repository: ppy/osu-difficulty-calculator + repository: peppy/osu-difficulty-calculator + ref: 'bypass-attrib-row-insert' path: 'master/osu-difficulty-calculator' - name: Checkout osu-difficulty-calculator (pr) uses: actions/checkout@v2 with: - repository: ppy/osu-difficulty-calculator + repository: peppy/osu-difficulty-calculator + ref: 'bypass-attrib-row-insert' path: 'pr/osu-difficulty-calculator' - name: Install .NET 5.0.x From a46fe5da75793867394fe1072268dc44b4a4a49c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 01:14:33 +0900 Subject: [PATCH 12/19] Simplify action --- .github/workflows/test-diffcalc.yml | 44 ++++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 23b5c8bd2c..b5937c1378 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -10,9 +10,6 @@ on: types: [ created ] env: - DB_USER: root - DB_HOST: 127.0.0.1 - DB_PORT: 3306 CONCURRENCY: 4 ALLOW_DOWNLOAD: 1 SAVE_DOWNLOADED: 1 @@ -44,12 +41,14 @@ jobs: - name: Verify MySQL connection from host run: | - mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "SHOW DATABASES" + mysql -e "SHOW DATABASES" - name: Drop previous databases run: | - mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "DROP DATABASE IF EXISTS osu_master" - mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e "DROP DATABASE IF EXISTS osu_pr" + for db in osu_master osu_pr + do + mysql -e "DROP DATABASE IF EXISTS $db" + done - name: Create directory structure run: | @@ -68,7 +67,6 @@ jobs: with: path: 'pr/osu' - # Checkout osu-difficulty-calculator - name: Checkout osu-difficulty-calculator (master) uses: actions/checkout@v2 with: @@ -99,7 +97,6 @@ jobs: ./UseLocalOsu.sh dotnet build - # Initial data imports - name: Download + import data run: | 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') @@ -112,19 +109,33 @@ jobs: 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 + cd $PERFORMANCE_DATA_NAME - 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" + for db in osu_master osu_pr + do + echo "Setting up database $db.." - echo "Importing SQL..." - { 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' + mysql -e "CREATE DATABASE $db" + + echo "Importing beatmaps..." + cat osu_beatmaps.sql | mysql $db + cat osu_beatmapsets.sql | mysql $db + + mysql $db -e "CREATE TABLE `osu_beatmap_difficulty` ( + `beatmap_id` int unsigned NOT NULL, + `mode` tinyint NOT NULL DEFAULT '0', + `mods` int unsigned NOT NULL, + `diff_unified` float NOT NULL, + `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`beatmap_id`,`mode`,`mods`), + KEY `diff_sort` (`mode`,`mods`,`diff_unified`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;" + done - # Run diffcalc - name: Run diffcalc (master) env: DB_NAME: osu_master @@ -138,10 +149,9 @@ jobs: 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: | - mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USER }} -e " + mysql -e " SELECT m.beatmap_id, m.mods, From 5b9cab8b1fca1054a4eebea5af8613853b831cd5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 01:44:07 +0900 Subject: [PATCH 13/19] Add more log output and quiet `wget` --- .github/workflows/test-diffcalc.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index b5937c1378..e9fd624168 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -107,10 +107,14 @@ jobs: cd $GITHUB_WORKSPACE - wget https://data.ppy.sh/$PERFORMANCE_DATA_NAME.tar.bz2 - wget https://data.ppy.sh/$BEATMAPS_DATA_NAME.tar.bz2 - + echo "Downloading database dump $PERFORMANCE_DATA_NAME.." + wget -q -nc https://data.ppy.sh/$PERFORMANCE_DATA_NAME.tar.bz2 + echo "Extracting.." tar -xf $PERFORMANCE_DATA_NAME.tar.bz2 + + echo "Downloading beatmap dump $BEATMAPS_DATA_NAME.." + wget -q https://data.ppy.sh/$BEATMAPS_DATA_NAME.tar.bz2 + echo "Extracting.." tar -xf $BEATMAPS_DATA_NAME.tar.bz2 cd $PERFORMANCE_DATA_NAME @@ -121,19 +125,21 @@ jobs: mysql -e "CREATE DATABASE $db" - echo "Importing beatmaps..." + echo "Importing beatmaps.." cat osu_beatmaps.sql | mysql $db + echo "Importing beatmapsets.." cat osu_beatmapsets.sql | mysql $db - mysql $db -e "CREATE TABLE `osu_beatmap_difficulty` ( + echo "Creating table structure.." + mysql $db -e 'CREATE TABLE `osu_beatmap_difficulty` ( `beatmap_id` int unsigned NOT NULL, - `mode` tinyint NOT NULL DEFAULT '0', + `mode` tinyint NOT NULL DEFAULT 0, `mods` int unsigned NOT NULL, `diff_unified` float NOT NULL, `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`beatmap_id`,`mode`,`mods`), KEY `diff_sort` (`mode`,`mods`,`diff_unified`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;" + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;' done - name: Run diffcalc (master) From f73ebfcea188b19de4b9f7f804229d15b6de4bbc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 01:44:54 +0900 Subject: [PATCH 14/19] Don't redownload if file already exists --- .github/workflows/test-diffcalc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index e9fd624168..dd623f59ce 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -113,7 +113,7 @@ jobs: tar -xf $PERFORMANCE_DATA_NAME.tar.bz2 echo "Downloading beatmap dump $BEATMAPS_DATA_NAME.." - wget -q https://data.ppy.sh/$BEATMAPS_DATA_NAME.tar.bz2 + wget -q -nc https://data.ppy.sh/$BEATMAPS_DATA_NAME.tar.bz2 echo "Extracting.." tar -xf $BEATMAPS_DATA_NAME.tar.bz2 From afcf3edec99d76c7937683abd249d9efcc5b0a39 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 02:27:21 +0900 Subject: [PATCH 15/19] Build build matrix dynamically --- .github/workflows/test-diffcalc.yml | 51 ++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index dd623f59ce..75742f2bde 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -16,29 +16,50 @@ env: SKIP_INSERT_ATTRIBUTES: 1 jobs: + metadata: + runs-on: self-hosted + 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') + outputs: + matrix: ${{ steps.generate-matrix.outputs.matrix }} + continue: ${{ steps.generate-matrix.outputs.continue }} + steps: + - name: generate matrix + id: generate-matrix + run: | + if [[ "${{ github.event.comment.body }}" =~ "1" ]] ; then + MATRIX_PROJECTS_JSON+='{ "name": "osu", "id": 0 },' + fi + if [[ "${{ github.event.comment.body }}" =~ "2" ]] ; then + MATRIX_PROJECTS_JSON+='{ "name": "taiko", "id": 1 },' + fi + if [[ "${{ github.event.comment.body }}" =~ "3" ]] ; then + MATRIX_PROJECTS_JSON+='{ "name": "catch", "id": 2 },' + fi + if [[ "${{ github.event.comment.body }}" =~ "4" ]] ; then + MATRIX_PROJECTS_JSON+='{ "name": "mania", "id": 3 },' + fi + + if [[ "${MATRIX_PROJECTS_JSON}" != "" ]]; then + MATRIX_JSON="{ \"ruleset\": [ ${MATRIX_PROJECTS_JSON} ] }" + echo "${MATRIX_JSON}" + CONTINUE="yes" + else + CONTINUE="no" + fi + + echo "::set-output name=continue::${CONTINUE}" + echo "::set-output name=matrix::${MATRIX_JSON}" diffcalc: name: Diffcalc runs-on: self-hosted continue-on-error: true - - 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') + if: needs.metadata.outputs.continue == 'yes' + needs: metadata strategy: - fail-fast: false - matrix: - ruleset: - - { name: osu, id: 0 } - - { name: taiko, id: 1 } - - { name: fruits, id: 2 } - - { name: mania, id: 3 } + matrix: ${{ fromJson(needs.metadata.outputs.matrix) }} steps: - - 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 - - name: Verify MySQL connection from host run: | mysql -e "SHOW DATABASES" From f282bd6f42c758be1e111755ee33839e362f0638 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 02:47:27 +0900 Subject: [PATCH 16/19] Tidy up naming --- .github/workflows/test-diffcalc.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index 75742f2bde..c83cbf5d61 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -4,7 +4,7 @@ # !pp check 0 2 | Runs only the osu! and catch rulesets. # -name: Diffcalc Consistency Checks +name: Difficulty Calculation on: issue_comment: types: [ created ] @@ -17,13 +17,14 @@ env: jobs: metadata: + name: Check for requests runs-on: self-hosted 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') outputs: matrix: ${{ steps.generate-matrix.outputs.matrix }} continue: ${{ steps.generate-matrix.outputs.continue }} steps: - - name: generate matrix + - name: Construct build matrix id: generate-matrix run: | if [[ "${{ github.event.comment.body }}" =~ "1" ]] ; then @@ -50,15 +51,13 @@ jobs: echo "::set-output name=continue::${CONTINUE}" echo "::set-output name=matrix::${MATRIX_JSON}" diffcalc: - name: Diffcalc + name: Run runs-on: self-hosted continue-on-error: true if: needs.metadata.outputs.continue == 'yes' needs: metadata - strategy: matrix: ${{ fromJson(needs.metadata.outputs.matrix) }} - steps: - name: Verify MySQL connection from host run: | From 192089db61398096d61494b3f77d66687de0d43d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 02:54:37 +0900 Subject: [PATCH 17/19] Use keywords instead of IDs --- .github/workflows/test-diffcalc.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/test-diffcalc.yml index c83cbf5d61..edb9fbd323 100644 --- a/.github/workflows/test-diffcalc.yml +++ b/.github/workflows/test-diffcalc.yml @@ -27,16 +27,16 @@ jobs: - name: Construct build matrix id: generate-matrix run: | - if [[ "${{ github.event.comment.body }}" =~ "1" ]] ; then + if [[ "${{ github.event.comment.body }}" =~ "osu" ]] ; then MATRIX_PROJECTS_JSON+='{ "name": "osu", "id": 0 },' fi - if [[ "${{ github.event.comment.body }}" =~ "2" ]] ; then + if [[ "${{ github.event.comment.body }}" =~ "taiko" ]] ; then MATRIX_PROJECTS_JSON+='{ "name": "taiko", "id": 1 },' fi - if [[ "${{ github.event.comment.body }}" =~ "3" ]] ; then + if [[ "${{ github.event.comment.body }}" =~ "catch" ]] ; then MATRIX_PROJECTS_JSON+='{ "name": "catch", "id": 2 },' fi - if [[ "${{ github.event.comment.body }}" =~ "4" ]] ; then + if [[ "${{ github.event.comment.body }}" =~ "mania" ]] ; then MATRIX_PROJECTS_JSON+='{ "name": "mania", "id": 3 },' fi From a694d482ed1c2fee5d0a153f4b2009910a95e6cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 12:32:26 +0900 Subject: [PATCH 18/19] Rename file --- .github/workflows/{test-diffcalc.yml => diffcalc.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test-diffcalc.yml => diffcalc.yml} (100%) diff --git a/.github/workflows/test-diffcalc.yml b/.github/workflows/diffcalc.yml similarity index 100% rename from .github/workflows/test-diffcalc.yml rename to .github/workflows/diffcalc.yml From ea624489ca809327e37a9952b0d90cf96c168ec1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Sep 2021 12:48:10 +0900 Subject: [PATCH 19/19] Remove continue-on-error --- .github/workflows/diffcalc.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/diffcalc.yml b/.github/workflows/diffcalc.yml index edb9fbd323..842522ae87 100644 --- a/.github/workflows/diffcalc.yml +++ b/.github/workflows/diffcalc.yml @@ -53,7 +53,6 @@ jobs: diffcalc: name: Run runs-on: self-hosted - continue-on-error: true if: needs.metadata.outputs.continue == 'yes' needs: metadata strategy: