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

CI: retrieve starknet devnet version from .env.devnet #372

Merged
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
6 changes: 5 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ jobs:
cache-sdk: true
- uses: bluefireteam/melos-action@v3
- run: melos bootstrap
- name: Retrieve starknet devnet version
shell: bash
run: |
grep STARKNET_DEVNET_VERSION .env.devnet | sed 's|export ||g' >> $GITHUB_ENV
Comment on lines +52 to +55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The STARKNET_DEVNET_VERSION variable is set in the .env.devnet file with the value 0.0.5. However, the initial script to verify if the variable is set and not empty did not produce any output. This suggests that the variable might not be correctly exported to the GitHub Actions environment.

To ensure the variable is correctly exported, consider adding a check in the GitHub Actions workflow to verify that the variable is set and not empty after attempting to export it.

  • Location to update: .github/workflows/ci.yaml
  • Suggested addition:
        - name: Retrieve starknet devnet version
          shell: bash
          run: |
            grep STARKNET_DEVNET_VERSION .env.devnet | sed 's|export ||g' >> $GITHUB_ENV
            if [ -z "$STARKNET_DEVNET_VERSION" ]; then
              echo "STARKNET_DEVNET_VERSION is not set or is empty" >&2
              exit 1
            fi
Analysis chain

The approach to dynamically retrieve the starknet-devnet version is sound. However, consider adding a check to ensure the STARKNET_DEVNET_VERSION variable is successfully retrieved and not empty.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the STARKNET_DEVNET_VERSION is set and not empty.

# Test: Check if the variable is set and non-empty. Expect: Non-empty output.
echo $STARKNET_DEVNET_VERSION

Length of output: 7



Script:

#!/bin/bash
# Description: Check the contents of the .env.devnet file for the STARKNET_DEVNET_VERSION variable.

# Test: Display the line containing STARKNET_DEVNET_VERSION. Expect: Line with STARKNET_DEVNET_VERSION and its value.
grep STARKNET_DEVNET_VERSION .env.devnet

Length of output: 79

- name: Run starknet-devnet as a background process
run: |
docker run -d --name starknet-devnet \
-v ${{ github.workspace }}/assets/devnet-dump.json:$DEVNET_DUMP_PATH \
-p 5050:5050 \
--entrypoint tini \
shardlabs/starknet-devnet-rs:0.0.5 -- \
shardlabs/starknet-devnet-rs:$STARKNET_DEVNET_VERSION -- \
starknet-devnet --host 0.0.0.0 --seed 0 --dump-path $DEVNET_DUMP_PATH
sleep 3 # Wait for 3 seconds for the Docker container to initialize
- run: melos test:dart:integration
Expand Down
Loading