diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 427b526..ea1fca6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -47,6 +47,9 @@ jobs: with: starknet-foundry-version: latest + - name: Verify universal-sierra-compiler installation + run: universal-sierra-compiler --version + - name: Create new project run: snforge init myproject diff --git a/dist/index.js b/dist/index.js index 25c0b1d..3b94530 100644 --- a/dist/index.js +++ b/dist/index.js @@ -29930,6 +29930,7 @@ function getOsPlatform() { + async function downloadStarknetFoundry(repo, version) { const triplet = getOsTriplet(); const tag = versionWithPrefix(version); @@ -29963,6 +29964,21 @@ async function findStarknetFoundryDir(extractedPath) { ); } +async function downloadUniversalSierraCompiler() { + const scriptUrl = + "https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh"; + + try { + const scriptPath = await tool_cache.downloadTool(scriptUrl); + + await exec.exec(`chmod +x ${scriptPath}`); + + await exec.exec(scriptPath); + } catch (error) { + core.setFailed(error.message); + } +} + ;// CONCATENATED MODULE: ./lib/main.js @@ -29995,6 +30011,7 @@ async function main() { triplet, ); if (!StarknetFoundryPrefix) { + await downloadUniversalSierraCompiler(); const download = await downloadStarknetFoundry( StarknetFoundryRepo, StarknetFoundryVersion, diff --git a/lib/download.js b/lib/download.js index aefa596..1dc32d0 100644 --- a/lib/download.js +++ b/lib/download.js @@ -2,6 +2,7 @@ import path from "path"; import fs from "fs/promises"; import * as core from "@actions/core"; import * as tc from "@actions/tool-cache"; +import * as exec from "@actions/exec"; import { getOsTriplet } from "./platform"; import { versionWithPrefix } from "./versions"; @@ -37,3 +38,18 @@ async function findStarknetFoundryDir(extractedPath) { `could not find Starknet Foundry directory in ${extractedPath}`, ); } + +export async function downloadUniversalSierraCompiler() { + const scriptUrl = + "https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh"; + + try { + const scriptPath = await tc.downloadTool(scriptUrl); + + await exec.exec(`chmod +x ${scriptPath}`); + + await exec.exec(scriptPath); + } catch (error) { + core.setFailed(error.message); + } +} diff --git a/lib/main.js b/lib/main.js index 118c155..bc027c5 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,7 +3,10 @@ import { getFullVersionFromStarknetFoundry, versionWithPrefix, } from "./versions"; -import { downloadStarknetFoundry } from "./download"; +import { + downloadStarknetFoundry, + downloadUniversalSierraCompiler, +} from "./download"; import { getOsTriplet } from "./platform"; import path from "path"; import * as core from "@actions/core"; @@ -33,6 +36,7 @@ export default async function main() { triplet, ); if (!StarknetFoundryPrefix) { + await downloadUniversalSierraCompiler(); const download = await downloadStarknetFoundry( StarknetFoundryRepo, StarknetFoundryVersion,