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

set-hyperdrivetypes-version.sh not working in CI #1185

Open
dpaiton opened this issue Oct 8, 2024 · 0 comments
Open

set-hyperdrivetypes-version.sh not working in CI #1185

dpaiton opened this issue Oct 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dpaiton
Copy link
Member

dpaiton commented Oct 8, 2024

set-hyperdrivetypes-version.sh is supposed to set the python project version for hyperdrivetypes in python/hyperdrivetypes/pyproject.toml to be the same as the version specified in contracts/src/libraries/Constants.sol. It works locally, and used to work in CI, but is now failing:

/bin/sh: 17: scripts/set-hyperdrivetypes-version.sh: [[: not found
writing to python/hyperdrivetypes/pyproject.toml
/bin/sh: 20: scripts/set-hyperdrivetypes-version.sh: [[: not found
Unsupported OS: 
make[1]: Leaving directory '/home/runner/work/hyperdrive/hyperdrive'

the error had an empty string for $OSTYPE

Unsupported OS: 

Here's the script:

#!/bin/bash

echo "get hyperdrive version"

# Extract version using sed by reading from the file
HYPERDRIVE_FILE="contracts/src/libraries/Constants.sol"
VERSION=$(sed -n -E 's/.*VERSION = "v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$HYPERDRIVE_FILE")

# Determine the OS using uname and convert to lowercase
OS_TYPE=$(uname | tr '[:upper:]' '[:lower:]')

# Append the version to hyperdrivetypes
HYPERDRIVETYPES_FILE="python/hyperdrivetypes/pyproject.toml"
echo "found version: v$VERSION"
echo "writing to $HYPERDRIVETYPES_FILE"
# Check the operating system to use the correct sed syntax
if [[ "$OSTYPE" == "darwin"* ]]; then
  # e.g. macOS
  sed -i '' -E "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+(\.*[0-9]*\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE"
elif [[ "$OSTYPE" == "linux"* ]]; then
  # e.g. Ubuntu
  sed -i -E "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+(\.*[0-9]*\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE"
else
  echo "Unsupported OS: $OSTYPE"
  # exit 1
fi

which I guess means uname | tr '[:upper:]' '[:lower:]' failed... maybe the container doesn't have uname installed?

@dpaiton dpaiton added the bug Something isn't working label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant