-
Notifications
You must be signed in to change notification settings - Fork 17
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
Testing workflow. #353
Draft
willis89pr
wants to merge
4
commits into
main
Choose a base branch
from
cyt-1133-ci-plugins
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Testing workflow. #353
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.github/workflows/test_plugins.yml
Outdated
Comment on lines
12
to
95
name: ${{ matrix.os }} Python ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.8", "3.10", "3.13"] | ||
|
||
steps: | ||
# Step 1: Check out the repository | ||
- uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up Python | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
# Step 3: Test plugins | ||
- name: Test Plugins | ||
run: | | ||
# Define the plugins directory and ignored directories | ||
PLUGINS_DIR="Surfactant/plugins" | ||
# IGNORED_DIRS=("example_plugin_to_ignore" "another_plugin_to_ignore") | ||
IGNORED_DIRS=("") | ||
|
||
# Iterate through each subdirectory in the plugins folder | ||
for PLUGIN_DIR in "$PLUGINS_DIR"/*; do | ||
# Skip if it's not a directory | ||
[ -d "$PLUGIN_DIR" ] || continue | ||
|
||
# Get the plugin name | ||
PLUGIN_NAME=$(basename "$PLUGIN_DIR") | ||
|
||
# Skip ignored directories | ||
if [[ " ${IGNORED_DIRS[@]} " =~ " ${PLUGIN_NAME} " ]]; then | ||
echo "Skipping ignored plugin: $PLUGIN_NAME" | ||
continue | ||
fi | ||
|
||
echo "Testing plugin: $PLUGIN_NAME" | ||
|
||
# Create a fresh virtual environment | ||
python -m venv venv | ||
source venv/bin/activate | ||
|
||
# Install Surfactant and the plugin | ||
pip install --upgrade pip | ||
pip install -e ./Surfactant | ||
pip install -e "$PLUGIN_DIR" | ||
|
||
# Check if tests exist in the plugin folder | ||
if [ -d "$PLUGIN_DIR/tests" ]; then | ||
echo "Tests found for $PLUGIN_NAME. Running pytest." | ||
|
||
# Run pytest in the plugin's folder | ||
pytest "$PLUGIN_DIR/tests" | ||
|
||
# Deactivate the virtual environment | ||
deactivate | ||
else | ||
echo "No tests found for $PLUGIN_NAME. Running basic functionality check." | ||
|
||
# Run the plugin on test files (adjust the command as needed) | ||
if [ -d "$PLUGIN_DIR/test_files" ]; then | ||
for TEST_FILE in "$PLUGIN_DIR/test_files"/*; do | ||
echo "Running $PLUGIN_NAME on $TEST_FILE" | ||
# Replace `plugin-command` with the actual command to invoke the plugin | ||
plugin-command "$TEST_FILE" | ||
done | ||
else | ||
echo "No test files found for $PLUGIN_NAME. Skipping functionality check." | ||
fi | ||
|
||
# Deactivate the virtual environment | ||
deactivate | ||
fi | ||
done | ||
|
||
# Step 4: Validate SBOM (optional) | ||
- name: Validate SBOM | ||
run: | | ||
# Placeholder for SBOM validation logic | ||
echo "SBOM validation step (to be implemented)" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium test
Actions Job or Workflow does not set permissions
for more information, see https://pre-commit.ci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
If merged this pull request will
Proposed changes