diff --git a/cachers.php b/cachers.php index 0e53fde..f597de0 100644 --- a/cachers.php +++ b/cachers.php @@ -197,14 +197,14 @@ function parse_build_properties(object $info) : ?array if (str_contains($asset->name, ".sha256")) continue; - if (str_contains($asset->name, "win64.7z")) - $ret["filename"] = $asset->name; - else if (str_contains($asset->name, "linux64.AppImage")) - $ret["filename"] = $asset->name; - else if (str_contains($asset->name, "macos.7z")) - $ret["filename"] = $asset->name; - else if (str_contains($asset->name, "macos_arm64.7z")) + if (str_contains($asset->name, "win64.7z") || + str_contains($asset->name, "linux64.AppImage") || + str_contains($asset->name, "linux_aarch64.AppImage") || + str_contains($asset->name, "macos.7z") || + str_contains($asset->name, "macos_arm64.7z")) + { $ret["filename"] = $asset->name; + } } // API Sanity Check @@ -322,6 +322,11 @@ function cache_build(int $pr) : void if (is_null($info_release_mac)) return; + // Linux arm64 build metadata + $info_release_linux_arm64 = curl_json("https://api.github.com/repos/rpcs3/rpcs3-binaries-linux-arm64/releases/tags/build-{$commit}", $cr); + if (is_null($info_release_linux_arm64)) + return; + // macOS arm64 build metadata $info_release_mac_arm64 = curl_json("https://api.github.com/repos/rpcs3/rpcs3-binaries-mac-arm64/releases/tags/build-{$commit}", $cr); if (is_null($info_release_mac_arm64)) @@ -329,6 +334,7 @@ function cache_build(int $pr) : void $is_missing = isset($info_release_win->message) || isset($info_release_linux->message) || + isset($info_release_linux_arm64->message) || isset($info_release_mac->message) || isset($info_release_mac_arm64->message); @@ -347,6 +353,7 @@ function cache_build(int $pr) : void $info_win = parse_build_properties($info_release_win); $info_linux = parse_build_properties($info_release_linux); $info_mac = parse_build_properties($info_release_mac); + $info_linux_arm64 = parse_build_properties($info_release_linux_arm64); $info_mac_arm64 = parse_build_properties($info_release_mac_arm64); // Fail if one of the builds is not available until a grace period has passed @@ -380,6 +387,16 @@ function cache_build(int $pr) : void return; } + if (!isset($version) && !is_null($info_linux_arm64)) + { + $version = $info_linux_arm64["version"]; + } + else if (!isset($version) && !$is_broken) + { + curl_close($cr); + return; + } + if (!isset($version) && !is_null($info_mac_arm64)) { $version = $info_mac_arm64["version"]; @@ -401,10 +418,11 @@ function cache_build(int $pr) : void if ($is_broken) { echo "A build is broken for Pull Request #{$pr}".PHP_EOL; - printf("Build status: Windows: %s, Linux: %s, macOS: %s, macOS arm64: %s", + printf("Build status: Windows: %s, Linux: %s, macOS: %s, Linux arm64: %s, macOS arm64: %s", isset($info_release_win->message) ? $info_release_win->message : "OK", isset($info_release_linux->message) ? $info_release_linux->message : "OK", isset($info_release_mac->message) ? $info_release_mac->message : "OK", + isset($info_release_linux_arm64->message) ? $info_release_linux_arm64->message : "OK", isset($info_release_mac_arm64->message) ? $info_release_mac_arm64->message : "OK"); } @@ -439,6 +457,9 @@ function cache_build(int $pr) : void `size_mac` = ".(isset($info_mac) ? "'".mysqli_real_escape_string($db, (string) $info_mac["size"])."'" : "NULL").", `checksum_mac` = ".(isset($info_mac) ? "'".mysqli_real_escape_string($db, (string) $info_mac["checksum"])."'" : "NULL").", `filename_mac` = ".(isset($info_mac) ? "'".mysqli_real_escape_string($db, (string) $info_mac["filename"])."'" : "NULL").", + `size_linux_arm64` = ".(isset($info_linux_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_linux_arm64["size"])."'" : "NULL").", + `checksum_linux_arm64` = ".(isset($info_linux_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_linux_arm64["checksum"])."'" : "NULL").", + `filename_linux_arm64` = ".(isset($info_linux_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_linux_arm64["filename"])."'" : "NULL").", `size_mac_arm64` = ".(isset($info_mac_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_mac_arm64["size"])."'" : "NULL").", `checksum_mac_arm64` = ".(isset($info_mac_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_mac_arm64["checksum"])."'" : "NULL").", `filename_mac_arm64` = ".(isset($info_mac_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_mac_arm64["filename"])."'" : "NULL").", @@ -470,6 +491,9 @@ function cache_build(int $pr) : void `size_mac`, `checksum_mac`, `filename_mac`, + `size_linux_arm64`, + `checksum_linux_arm64`, + `filename_linux_arm64`, `size_mac_arm64`, `checksum_mac_arm64`, `filename_mac_arm64`, @@ -495,6 +519,9 @@ function cache_build(int $pr) : void ".(isset($info_mac) ? "'".mysqli_real_escape_string($db, (string) $info_mac["size"])."'" : "NULL").", ".(isset($info_mac) ? "'".mysqli_real_escape_string($db, (string) $info_mac["checksum"])."'" : "NULL").", ".(isset($info_mac) ? "'".mysqli_real_escape_string($db, (string) $info_mac["filename"])."'" : "NULL").", + ".(isset($info_linux_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_linux_arm64["size"])."'" : "NULL").", + ".(isset($info_linux_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_linux_arm64["checksum"])."'" : "NULL").", + ".(isset($info_linux_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_linux_arm64["filename"])."'" : "NULL").", ".(isset($info_mac_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_mac_arm64["size"])."'" : "NULL").", ".(isset($info_mac_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_mac_arm64["checksum"])."'" : "NULL").", ".(isset($info_mac_arm64) ? "'".mysqli_real_escape_string($db, (string) $info_mac_arm64["filename"])."'" : "NULL").", diff --git a/database.sql b/database.sql index 77b1307..ea27728 100644 --- a/database.sql +++ b/database.sql @@ -43,6 +43,9 @@ CREATE TABLE `builds` ( `filename_mac` varchar(128) DEFAULT NULL, `checksum_mac` varchar(64) DEFAULT NULL COMMENT 'sha256', `size_mac` int(11) DEFAULT NULL, + `filename_linux_arm64` varchar(128) DEFAULT NULL, + `checksum_linux_arm64` varchar(64) DEFAULT NULL COMMENT 'sha256', + `size_linux_arm64` int(11) DEFAULT NULL, `filename_mac_arm64` varchar(128) DEFAULT NULL, `checksum_mac_arm64` varchar(64) DEFAULT NULL COMMENT 'sha256', `size_mac_arm64` int(11) DEFAULT NULL, diff --git a/objects/Build.php b/objects/Build.php index defa0b9..389cd4b 100644 --- a/objects/Build.php +++ b/objects/Build.php @@ -46,6 +46,10 @@ class Build public ?int $size_mac; public ?string $filename_mac; + public ?string $checksum_linux_arm64; + public ?int $size_linux_arm64; + public ?string $filename_linux_arm64; + public ?string $checksum_mac_arm64; public ?int $size_mac_arm64; public ?string $filename_mac_arm64; @@ -73,6 +77,9 @@ function __construct( int $pr, ?string $checksum_mac, ?int $size_mac, ?string $filename_mac, + ?string $checksum_linux_arm64, + ?int $size_linux_arm64, + ?string $filename_linux_arm64, ?string $checksum_mac_arm64, ?int $size_mac_arm64, ?string $filename_mac_arm64, @@ -93,6 +100,9 @@ function __construct( int $pr, $this->checksum_mac = $checksum_mac; $this->size_mac = $size_mac; $this->filename_mac = $filename_mac; + $this->checksum_linux_arm64 = $checksum_linux_arm64; + $this->size_linux_arm64 = $size_linux_arm64; + $this->filename_linux_arm64 = $filename_linux_arm64; $this->checksum_mac_arm64 = $checksum_mac_arm64; $this->size_mac_arm64 = $size_mac_arm64; $this->filename_mac_arm64 = $filename_mac_arm64; @@ -166,6 +176,15 @@ public function get_url_mac() : ?string return null; } + public function get_url_linux_arm64() : ?string + { + if (!is_null($this->filename_linux_arm64)) + { + return "https://github.com/RPCS3/rpcs3-binaries-linux-arm64/releases/download/build-{$this->commit}/{$this->filename_linux_arm64}"; + } + return null; + } + public function get_url_mac_arm64() : ?string { if (!is_null($this->filename_mac_arm64)) @@ -212,6 +231,15 @@ public function get_size_mb_mac() : ?float return null; } + public function get_size_mb_linux_arm64() : ?float + { + if (!is_null($this->size_linux_arm64)) + { + return round($this->size_linux_arm64 / 1024 / 1024, 1); + } + return null; + } + public function get_size_mb_mac_arm64() : ?float { if (!is_null($this->size_mac_arm64)) @@ -315,6 +343,9 @@ public static function query_to_builds(mysqli_result $query) : array $row->checksum_mac, $row->size_mac, $row->filename_mac, + $row->checksum_linux_arm64, + $row->size_linux_arm64, + $row->filename_linux_arm64, $row->checksum_mac_arm64, $row->size_mac_arm64, $row->filename_mac_arm64,