Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d16a6da
Add `console.log`
franciszekjob Jun 23, 2025
93c7f66
Fix resolving scarb version
franciszekjob Jun 23, 2025
405d7e0
Change version in `Test local action`
franciszekjob Jun 23, 2025
861d4dd
Remove windows from os matrix
franciszekjob Jun 23, 2025
5dc5516
Remove running tests on windows
franciszekjob Jun 23, 2025
a62bfba
Run `npm run build`
franciszekjob Jun 23, 2025
61851e0
Simplify `determineVersion`
franciszekjob Jun 23, 2025
c4b042d
Remove running tests on Windows
franciszekjob Jun 23, 2025
c68e4cc
Merge branch 'remove-windows-support' of https://github.com/foundry-r…
franciszekjob Jun 23, 2025
0bf54e7
Fix variable name
franciszekjob Jun 23, 2025
34439c6
Fix resolving scarb version
franciszekjob Jun 23, 2025
84d0154
Merge branch 'remove-windows-support' of https://github.com/foundry-r…
franciszekjob Jun 23, 2025
ef39d4d
Another console.log
franciszekjob Jun 23, 2025
9c90e4b
Update console.log
franciszekjob Jun 23, 2025
2a508b3
Update console.log
franciszekjob Jun 23, 2025
e578c43
Add console.log
franciszekjob Jun 23, 2025
d383ccf
More logs
franciszekjob Jun 23, 2025
d6e4028
More logs
franciszekjob Jun 23, 2025
f386c58
Logs
franciszekjob Jun 23, 2025
a79c96e
Refactor `action.yml`
franciszekjob Jun 23, 2025
bef02b5
Little changes
franciszekjob Jun 23, 2025
d1523f8
Fix `determineVersion`
franciszekjob Jun 23, 2025
888756c
Include USC setup
franciszekjob Jun 23, 2025
d2cfeeb
Add envs in `action.yml`
franciszekjob Jun 23, 2025
2eb202b
Code cleanup
franciszekjob Jun 23, 2025
7887a96
Run `npm run build`
franciszekjob Jun 23, 2025
7e8373d
Remove console logs
franciszekjob Jun 23, 2025
04612c0
Add console.log
franciszekjob Jun 23, 2025
c20bc33
Add test for fixed version
franciszekjob Jun 23, 2025
a28ce41
Little refactor for fixed version validation
franciszekjob Jun 23, 2025
091271f
Formatting
franciszekjob Jun 23, 2025
249adeb
Temporarily change fixed version to make workflow fail
franciszekjob Jun 23, 2025
fd8d220
Refactor `Verify snforge version`
franciszekjob Jun 23, 2025
454f5cb
Restore correct version
franciszekjob Jun 23, 2025
099203e
Run `npm run build`
franciszekjob Jun 23, 2025
2029567
Refactor
franciszekjob Jun 23, 2025
86f87a6
Use `actions/checkout@v4` instead of v3
franciszekjob Jun 23, 2025
43e881b
Trigger CI
franciszekjob Jun 23, 2025
4307c6a
Temporarily change way, how `StarknetFoundryVersionInput` is determined
franciszekjob Jun 23, 2025
d687d35
Formatting
franciszekjob Jun 23, 2025
43da8b8
Formatting
franciszekjob Jun 23, 2025
0584815
Revert "Formatting"
franciszekjob Jun 23, 2025
e41727e
Add `workflow_dispatch`
franciszekjob Jun 23, 2025
527d558
Trigger CI
franciszekjob Jun 23, 2025
e97bad4
Fix `checks.yml`
franciszekjob Jun 23, 2025
adb34ba
Fix `checks.yml`
franciszekjob Jun 23, 2025
fc10d70
Code cleanup
franciszekjob Jun 23, 2025
a7d2f97
Restore previous logic in `determineVersion`
franciszekjob Jun 24, 2025
c296f21
Merge branch 'main' into 31-fix-determining-version
franciszekjob Jun 24, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Node.js 20.x
uses: actions/setup-node@v3
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20.x
Expand All @@ -28,7 +28,7 @@ jobs:
test-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get scarb version
id: extractScarbVersion
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
test-action-with-tools-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Create .tool-versions file"
shell: bash
Expand All @@ -75,3 +75,31 @@ jobs:

- run: snforge --version | grep "snforge 0.16.0"
shell: bash

test-action-with-fixed-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: "Setup Scarb"
uses: software-mansion/setup-scarb@v1
with:
scarb-version: 2.9.4

- name: "Setup foundry using fixed version"
uses: ./
with:
starknet-foundry-version: 0.44.0

- name: Verify snforge version
run: |
EXPECTED="snforge 0.44.0"
VERSION=$(snforge --version)

echo "Expected version: $EXPECTED"
echo "Actual version: $VERSION"

if [[ "$VERSION" != "$EXPECTED" ]]; then
echo "Version mismatch"
exit 1
fi
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ runs:
- name: Set up Starknet Foundry
shell: bash
run: node $GITHUB_ACTION_PATH/dist/index.js
env:
INPUT_STARKNET-FOUNDRY-VERSION: ${{ inputs.starknet-foundry-version }}
INPUT_TOOL-VERSIONS: ${{ inputs.tool-versions }}
12 changes: 4 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29824,12 +29824,12 @@ async function determineVersion(version, toolVersionsPath, repo) {

if (version && toolVersionsPath) {
throw new Error(
"the `starknet-foundry-version` and `tool-versions` inputs cannot be used simultaneously",
"`starknet-foundry-version` and `tool-versions` inputs cannot be used simultaneously",
);
}

if (toolVersionsPath) {
let toolVersion = await getVersionFromToolVersionsFile(toolVersionsPath);
const toolVersion = await getVersionFromToolVersionsFile(toolVersionsPath);

if (!toolVersion) {
throw new Error(
Expand All @@ -29840,19 +29840,15 @@ async function determineVersion(version, toolVersionsPath, repo) {
}

if (!version) {
let toolVersion = await getVersionFromToolVersionsFile();
const toolVersion = await getVersionFromToolVersionsFile();
version = toolVersion ?? "latest";
}

if (version === "latest") {
version = await fetchLatestTag(repo);
}

if (version.startsWith("v")) {
version = version.substring(1);
}

return version;
return version.startsWith("v") ? version.slice(1) : version;
}

function fetchLatestTag(repo) {
Expand Down
12 changes: 4 additions & 8 deletions lib/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export async function determineVersion(version, toolVersionsPath, repo) {

if (version && toolVersionsPath) {
throw new Error(
"the `starknet-foundry-version` and `tool-versions` inputs cannot be used simultaneously",
"`starknet-foundry-version` and `tool-versions` inputs cannot be used simultaneously",
);
}

if (toolVersionsPath) {
let toolVersion = await getVersionFromToolVersionsFile(toolVersionsPath);
const toolVersion = await getVersionFromToolVersionsFile(toolVersionsPath);

if (!toolVersion) {
throw new Error(
Expand All @@ -35,19 +35,15 @@ export async function determineVersion(version, toolVersionsPath, repo) {
}

if (!version) {
let toolVersion = await getVersionFromToolVersionsFile();
const toolVersion = await getVersionFromToolVersionsFile();
version = toolVersion ?? "latest";
}

if (version === "latest") {
version = await fetchLatestTag(repo);
}

if (version.startsWith("v")) {
version = version.substring(1);
}

return version;
return version.startsWith("v") ? version.slice(1) : version;
}

function fetchLatestTag(repo) {
Expand Down
Loading