input: Write a function to generate a simple linear regression model in Python. The function should read data from a CSV file, set the independent and dependent variables, train the model, make predictions, and visualize the results.
  assert perform_linear_regression("data.csv")==0
output: 
  def perform_linear_regression(filename):
      import pandas as pd
      from sklearn.linear_model import LinearRegression
      import matplotlib.pyplot as plt
  
      data = pd.read_csv(filename)
      X = data[['X']]
      y = data['y']
  
      model = LinearRegression()
      model.fit(X, y)
  
      predictions = model.predict(X)
  
      plt.scatter(X, y, color='blue')
      plt.plot(X, predictions, color='red')
      plt.xlabel('X')
      plt.ylabel('y')
      plt.title('Linear Regression')
      plt.show()
  
      return 0
  