Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add universal-sierra-compiler dependency #16

Merged
merged 6 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 17 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29930,6 +29930,7 @@ function getOsPlatform() {




async function downloadStarknetFoundry(repo, version) {
const triplet = getOsTriplet();
const tag = versionWithPrefix(version);
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -29995,6 +30011,7 @@ async function main() {
triplet,
);
if (!StarknetFoundryPrefix) {
await downloadUniversalSierraCompiler();
const download = await downloadStarknetFoundry(
StarknetFoundryRepo,
StarknetFoundryVersion,
Expand Down
16 changes: 16 additions & 0 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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}`);
war-in marked this conversation as resolved.
Show resolved Hide resolved

await exec.exec(scriptPath);
} catch (error) {
core.setFailed(error.message);
}
}
6 changes: 5 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -33,6 +36,7 @@ export default async function main() {
triplet,
);
if (!StarknetFoundryPrefix) {
await downloadUniversalSierraCompiler();
const download = await downloadStarknetFoundry(
StarknetFoundryRepo,
StarknetFoundryVersion,
Expand Down
Loading