mirror of
https://github.com/terrapkg/packages.git
synced 2026-07-03 01:10:51 +00:00
* fix: sccache setup and toggle (#10028) * fix: Try and fix sccache toggle...again Signed-off-by: Gilver <roachy@fyralabs.com> * Beep Signed-off-by: Gilver <roachy@fyralabs.com> * Revert "Beep" This reverts commit34ee5aa7fa. * ? Signed-off-by: Gilver <roachy@fyralabs.com> * chore: sccache path Signed-off-by: Gilver <roachy@fyralabs.com> * chore: Add back if Signed-off-by: Gilver <roachy@fyralabs.com> * The Success * fix: Reminder to disable autoformatting on Kate again * feat: sccache summary back Signed-off-by: Gilver <roachy@fyralabs.com> --------- Signed-off-by: Gilver <roachy@fyralabs.com> (cherry picked from commitd2e74d4b37) Signed-off-by: GildedRoach <GildedRoach@users.noreply.github.com> * Update configure-sccache.js Signed-off-by: Gilver <roachy@fyralabs.com> --------- Signed-off-by: Gilver <roachy@fyralabs.com> Signed-off-by: GildedRoach <GildedRoach@users.noreply.github.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// Note: ACTIONS_CACHE_SERVICE_V2 and SCCACHE_GHA_ENABLED are set at workflow level
|
||||
module.exports = async ({ github, context, core, exec }) => {
|
||||
// Find sccache path (try which command)
|
||||
let sccachePath = "sccache";
|
||||
let sccachePath = "/usr/bin/sccache";
|
||||
try {
|
||||
const result = await exec.getExecOutput("which", ["sccache"], {
|
||||
ignoreReturnCode: true,
|
||||
@@ -19,6 +19,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
} catch (e) {
|
||||
core.debug(`Could not find sccache path: ${e.message}`);
|
||||
}
|
||||
|
||||
// Check sccache version
|
||||
try {
|
||||
const versionResult = await exec.getExecOutput(sccachePath, ["--version"], {
|
||||
@@ -29,6 +30,14 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
} catch (e) {
|
||||
core.warning(`Could not get sccache version: ${e.message}`);
|
||||
}
|
||||
|
||||
// Enable caching
|
||||
core.exportVariable("RUSTC_WRAPPER", sccachePath);
|
||||
core.exportVariable("SCCACHE_GHA_ENABLED", "true");
|
||||
|
||||
// Disable Cargo incremental builds to not interfere with caching
|
||||
core.exportVariable("CARGO_INCREMENTAL", "false");
|
||||
|
||||
// Debug: Show what environment variables are available
|
||||
core.info("=== Environment Variables Diagnostic ===");
|
||||
core.info(`SCCACHE_GHA_ENABLED: ${process.env.SCCACHE_GHA_ENABLED}`);
|
||||
@@ -44,8 +53,10 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
core.info(`RUSTC_WRAPPER: ${process.env.RUSTC_WRAPPER}`);
|
||||
core.info(`SCCACHE_LOG: ${process.env.SCCACHE_LOG}`);
|
||||
core.info("========================================");
|
||||
|
||||
// Export SCCACHE_PATH so it's available to subsequent steps
|
||||
core.exportVariable("SCCACHE_PATH", sccachePath);
|
||||
|
||||
// Expose the GHA cache related variables to make it easier for users to
|
||||
// integrate with GHA support (from upstream mozilla/sccache-action)
|
||||
if (process.env.ACTIONS_RESULTS_URL) {
|
||||
@@ -56,6 +67,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
"ACTIONS_RESULTS_URL is not set - GitHub Actions cache WILL NOT work",
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.ACTIONS_RUNTIME_TOKEN) {
|
||||
core.exportVariable(
|
||||
"ACTIONS_RUNTIME_TOKEN",
|
||||
@@ -67,6 +79,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
"ACTIONS_RUNTIME_TOKEN is not set - GitHub Actions cache WILL NOT work",
|
||||
);
|
||||
}
|
||||
|
||||
// Set cache version and restore keys for this specific build matrix
|
||||
if (process.env.SCCACHE_GHA_VERSION) {
|
||||
core.exportVariable("SCCACHE_GHA_VERSION", process.env.SCCACHE_GHA_VERSION);
|
||||
@@ -77,6 +90,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
process.env.SCCACHE_GHA_CACHE_FROM,
|
||||
);
|
||||
}
|
||||
|
||||
// Check if cache busting is enabled
|
||||
const inputs =
|
||||
(github &&
|
||||
@@ -90,16 +104,20 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
process.env.INPUT_BUST_CACHE ??
|
||||
process.env.BUST_CACHE;
|
||||
let bustCache = false;
|
||||
|
||||
if (typeof rawBustCache === "string") {
|
||||
const v = rawBustCache.toLowerCase().trim();
|
||||
bustCache = v === "true" || v === "1" || v === "yes";
|
||||
} else {
|
||||
bustCache = !!rawBustCache;
|
||||
}
|
||||
|
||||
if (bustCache) {
|
||||
core.exportVariable("SCCACHE_BUST_CACHE", "true");
|
||||
core.exportVariable("SCCACHE_RECACHE", "1");
|
||||
core.info("SCCACHE_RECACHE enabled because bust_cache is true");
|
||||
}
|
||||
|
||||
// Stop any running sccache daemon so it picks up the new environment variables
|
||||
core.info("Stopping any running sccache daemon to pick up configuration...");
|
||||
try {
|
||||
@@ -112,6 +130,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
`Could not stop sccache daemon (it may not be running): ${e.message}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Verify sccache can see the GHA environment variables by starting server with explicit env
|
||||
core.info("Starting sccache server with GHA environment variables...");
|
||||
const sccacheEnv = {
|
||||
@@ -119,6 +138,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
SCCACHE_GHA_ENABLED: process.env.SCCACHE_GHA_ENABLED || "on",
|
||||
ACTIONS_CACHE_SERVICE_V2: process.env.ACTIONS_CACHE_SERVICE_V2 || "on",
|
||||
};
|
||||
|
||||
try {
|
||||
await exec.exec(sccachePath, ["--start-server"], {
|
||||
ignoreReturnCode: true,
|
||||
@@ -128,6 +148,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
} catch (e) {
|
||||
core.warning(`Could not start sccache server: ${e.message}`);
|
||||
}
|
||||
|
||||
// Show the current sccache configuration
|
||||
core.info("Verifying sccache configuration:");
|
||||
try {
|
||||
@@ -139,6 +160,7 @@ module.exports = async ({ github, context, core, exec }) => {
|
||||
env: sccacheEnv,
|
||||
},
|
||||
);
|
||||
|
||||
// Check if it's using GitHub Actions cache
|
||||
if (statsResult.stdout.includes("GitHub Actions")) {
|
||||
core.info("✓ sccache is configured to use GitHub Actions cache");
|
||||
|
||||
Reference in New Issue
Block a user