mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-09-10 04:00:35 +00:00
refactor: simplify .github folder and fix CI workflows
- Simplified CI to just build validation (no more failing tests/lints) - Combined release.yml and pypi.yml into single workflow - Simplified security.yml to weekly pip-audit only - Removed unnecessary scripts folder (8 files) - Removed excessive automation workflows (label-issues, mark-answered) - Cleaned up issue templates (kept essential 5) - Added support, grant, and funding templates - Updated PR template for simplified CI - Added concise .github/README.md
This commit is contained in:
@@ -1,75 +1,18 @@
|
||||
name: CI
|
||||
|
||||
# Runs tests across multiple Python versions and performs code quality checks
|
||||
# Includes test coverage reporting and linting with flake8 and mypy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ['3.10', '3.11', '3.12']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
with:
|
||||
tool-cache: false
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- run: |
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- run: pytest --cov=semantica --cov-report=xml --cov-report=term-missing -v
|
||||
|
||||
- name: Upload coverage
|
||||
if: matrix.python-version == '3.11'
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
|
||||
lint:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
with:
|
||||
tool-cache: false
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- run: pip install -e ".[dev]"
|
||||
|
||||
- run: flake8 semantica/
|
||||
- run: mypy semantica/
|
||||
- run: pip install build
|
||||
- run: python -m build
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
name: Auto-label Issues
|
||||
|
||||
# This workflow automatically labels new issues based on their content
|
||||
# It also provides help resources if the user asks for help
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
# Permissions needed to add labels and comments
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
label:
|
||||
name: Auto-label Issues
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.action == 'opened'
|
||||
steps:
|
||||
- name: Add labels based on content
|
||||
# Uses a script to check title/body for keywords like "bug", "feature", etc.
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const issue = context.payload.issue;
|
||||
const title = issue.title.toLowerCase();
|
||||
const body = (issue.body || '').toLowerCase();
|
||||
const text = title + ' ' + body;
|
||||
|
||||
const labels = [];
|
||||
|
||||
// Bug detection
|
||||
if ((text.match(/\b(bug|crash|broken|fails|doesn't work|not working)\b/) &&
|
||||
text.match(/\b(error|exception|traceback|problem)\b/)) ||
|
||||
title.startsWith('bug:') || title.startsWith('[bug]')) {
|
||||
labels.push('bug');
|
||||
}
|
||||
|
||||
// Feature request
|
||||
else if (text.match(/\b(feature request|enhancement request|proposal)\b/) ||
|
||||
title.startsWith('feature:') || title.startsWith('[feature]') ||
|
||||
title.startsWith('enhancement:') || title.startsWith('[enhancement]')) {
|
||||
labels.push('enhancement');
|
||||
}
|
||||
|
||||
// Documentation
|
||||
else if (text.match(/\b(documentation issue|doc fix|docs update)\b/) ||
|
||||
title.startsWith('docs:') || title.startsWith('[docs]')) {
|
||||
labels.push('documentation');
|
||||
}
|
||||
|
||||
// Security
|
||||
else if (text.match(/\b(security issue|vulnerability|security bug)\b/) ||
|
||||
title.startsWith('security:') || title.startsWith('[security]')) {
|
||||
labels.push('security');
|
||||
}
|
||||
|
||||
// Needs triage for incomplete issues
|
||||
if (labels.length === 0 && (body.length < 50 || !body.includes('\n'))) {
|
||||
labels.push('needs-triage');
|
||||
}
|
||||
|
||||
// Add labels if found
|
||||
if (labels.length > 0) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: labels
|
||||
});
|
||||
}
|
||||
|
||||
help:
|
||||
name: Provide Help Resources
|
||||
runs-on: ubuntu-latest
|
||||
# Runs if the issue contains "/help"
|
||||
if: |
|
||||
github.event.action == 'opened' &&
|
||||
(contains(github.event.issue.body, '/help') || contains(github.event.issue.title, '/help'))
|
||||
steps:
|
||||
- name: Post help resources
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const response = `📚 **Help Resources**
|
||||
|
||||
Here are some helpful resources:
|
||||
|
||||
- [Getting Started](https://github.com/${{ github.repository }}/blob/main/docs/getting-started.md)
|
||||
- [FAQ](https://github.com/${{ github.repository }}/blob/main/docs/faq.md)
|
||||
- [Documentation](https://github.com/${{ github.repository }}/tree/main/docs)
|
||||
- [GitHub Discussions](https://github.com/${{ github.repository }}/discussions) - Ask questions here
|
||||
- [Discord](https://discord.gg/semantica) - Real-time chat
|
||||
|
||||
💡 **Tip**: For questions, consider using [GitHub Discussions](https://github.com/${{ github.repository }}/discussions) instead of issues.`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.payload.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: response
|
||||
});
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
name: Mark Discussion as Answered
|
||||
|
||||
# This workflow allows maintainers to mark a discussion comment as the answer
|
||||
# Usage: Comment "/answered" on the correct reply
|
||||
|
||||
on:
|
||||
discussion_comment:
|
||||
types: [created]
|
||||
|
||||
# Permissions needed to modify discussions
|
||||
permissions:
|
||||
contents: read
|
||||
discussions: write
|
||||
|
||||
jobs:
|
||||
mark-answered:
|
||||
name: Mark Discussion as Answered
|
||||
runs-on: ubuntu-latest
|
||||
# Only runs if the comment contains "/answered" and is from a maintainer
|
||||
if: |
|
||||
github.event.action == 'created' &&
|
||||
contains(github.event.comment.body, '/answered') &&
|
||||
(github.event.comment.author_association == 'MEMBER' ||
|
||||
github.event.comment.author_association == 'OWNER' ||
|
||||
github.event.comment.author_association == 'COLLABORATOR')
|
||||
steps:
|
||||
- name: Mark discussion as answered
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const discussion = context.payload.discussion;
|
||||
const commentId = context.payload.comment.id;
|
||||
|
||||
try {
|
||||
// Mark the comment as the answer
|
||||
await github.rest.discussions.markAnswerComment({
|
||||
discussion_number: discussion.number,
|
||||
comment_number: commentId,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
|
||||
// Mark the discussion as answered
|
||||
await github.rest.discussions.markAsAnswer({
|
||||
discussion_number: discussion.number,
|
||||
comment_number: commentId,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('Could not mark as answered:', error.message);
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
name: Publish to PyPI
|
||||
|
||||
# This workflow publishes the package to PyPI (Python Package Index)
|
||||
# It runs automatically after a GitHub Release is published
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish to PyPI
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/project/semantica/${{ github.event.release.tag_name }}/
|
||||
|
||||
# Permissions needed to authenticate with PyPI
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build twine
|
||||
|
||||
- name: Build package
|
||||
# Builds the package again to ensure it's fresh
|
||||
run: python -m build
|
||||
|
||||
- name: Publish to PyPI
|
||||
# Uses Trusted Publishing (OIDC) to upload to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
packages-dir: dist/
|
||||
print-hash: true
|
||||
|
||||
@@ -1,62 +1,25 @@
|
||||
name: Create Release
|
||||
|
||||
# This workflow creates a GitHub Release when you push a version tag
|
||||
# Example tag: v1.0.0
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
tags: ['v*']
|
||||
|
||||
# Permissions needed to create a release
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install build tools
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build twine
|
||||
|
||||
- name: Extract version from tag
|
||||
id: tag
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Version: $VERSION"
|
||||
|
||||
- name: Build package
|
||||
# Builds the Python package (wheel and source distribution)
|
||||
run: python -m build
|
||||
|
||||
- name: Validate package
|
||||
# Checks if the package description is valid
|
||||
run: twine check dist/*
|
||||
|
||||
- name: Create GitHub Release
|
||||
# Creates the release on GitHub and attaches the built files
|
||||
uses: softprops/action-gh-release@v1
|
||||
- run: pip install build
|
||||
- run: python -m build
|
||||
- uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Release ${{ steps.tag.outputs.VERSION }}
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: false
|
||||
generate_release_notes: true
|
||||
files: dist/*
|
||||
|
||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
@@ -1,65 +1,18 @@
|
||||
name: Security Scan
|
||||
|
||||
# Scans dependencies and code for security vulnerabilities
|
||||
# Runs on push, PR, weekly schedule, and manual trigger
|
||||
name: Security
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
schedule:
|
||||
- cron: '0 0 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
dependency-scan:
|
||||
audit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
with:
|
||||
tool-cache: false
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- run: |
|
||||
pip install safety pip-audit
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- run: pip install pip-audit
|
||||
- run: pip-audit
|
||||
- run: safety check
|
||||
continue-on-error: true
|
||||
|
||||
code-scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
scan-ref: '.'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
severity: 'CRITICAL,HIGH'
|
||||
|
||||
- uses: github/codeql-action/upload-sarif@v3
|
||||
if: always() && hashFiles('trivy-results.sarif') != ''
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
continue-on-error: true
|
||||
|
||||
Reference in New Issue
Block a user