Skip to content

Conversation

@joellidin
Copy link
Collaborator

Closes #49

Add GitHub Actions Workflow for Running Tests

Summary

This PR introduces a GitHub Actions workflow to automatically run tests on every push to the main branch and for every pull request. The workflow runs tests on Python 3.11 and 3.12 using pytest.

Changes Introduced

  • Added a Run Tests workflow in .github/workflows/test.yml.
  • The workflow:
    • Runs on ubuntu-latest.
    • Installs project dependencies using uv.
    • Runs tests with pytest.
    • Uses GitHub secrets for credentials.

Required GitHub Secrets

To ensure the tests can access the required resources, these secrets must be set in your GitHub repository:

Gradient Storage

  • R2_GRADIENTS_ACCOUNT_ID
  • R2_GRADIENTS_BUCKET_NAME
  • R2_GRADIENTS_READ_ACCESS_KEY_ID
  • R2_GRADIENTS_READ_SECRET_ACCESS_KEY
  • R2_GRADIENTS_WRITE_ACCESS_KEY_ID
  • R2_GRADIENTS_WRITE_SECRET_ACCESS_KEY

Dataset Storage

  • R2_DATASET_ACCOUNT_ID
  • R2_DATASET_BUCKET_NAME
  • R2_DATASET_READ_ACCESS_KEY_ID
  • R2_DATASET_READ_SECRET_ACCESS_KEY
  • R2_DATASET_WRITE_ACCESS_KEY_ID
  • R2_DATASET_WRITE_SECRET_ACCESS_KEY

Once these secrets are in place, the workflow will install dependencies and run tests against the specified environments.

@joellidin
Copy link
Collaborator Author

I noticed that tests/test_r2_loader.py requires the .env file which would not exist in the github workflow environment:
https://github.com/tplr-ai/templar/blob/4905a3cd1eb81f103014ccea8e18b99fd0dfaf77/tests/test_r2_loader.py#L6-L9

However, the required environment variables are already defined later in the file, making this requirement unnecessary. I’d suggest removing it to prevent potential issues.

That said, I understand you’re planning to restructure the testing setup, so let me know if this PR is appropriate at this time.

@joellidin joellidin force-pushed the ci/add-tests-workflow branch from 46b0878 to 2997a63 Compare January 30, 2025 12:19
@distributedstatemachine
Copy link
Member

@joellidin thanks alot for this PR ! I just committted this to my b723676 , can you please open this against feat/validator_gathers so we dont clash ? tysm!

@distributedstatemachine distributedstatemachine changed the base branch from main to feat/validator_gathers January 30, 2025 14:58
@distributedstatemachine
Copy link
Member

I noticed that tests/test_r2_loader.py requires the .env file which would not exist in the github workflow environment:

https://github.com/tplr-ai/templar/blob/4905a3cd1eb81f103014ccea8e18b99fd0dfaf77/tests/test_r2_loader.py#L6-L9

However, the required environment variables are already defined later in the file, making this requirement unnecessary. I’d suggest removing it to prevent potential issues.

That said, I understand you’re planning to restructure the testing setup, so let me know if this PR is appropriate at this time.

yeh its pretty ugly, i have a hack for now , where i recreate it in the runner, but will clean up when we handle the tests refactor

@distributedstatemachine distributedstatemachine merged commit f8b9514 into one-covenant:feat/validator_gathers Jan 30, 2025
1 of 3 checks passed
epappas pushed a commit to epappas/bittensor-templar that referenced this pull request Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci tests

2 participants