Skip to content

Commit

Permalink
Merge branch 'main' into e2e_tests_for_all
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajgupta36 authored Mar 2, 2025
2 parents a456151 + bfba31f commit 5b4befc
Show file tree
Hide file tree
Showing 46 changed files with 21,359 additions and 16,598 deletions.
22 changes: 22 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
chat:
auto_reply: true
code_generation:
docstrings:
language: en-US
early_access: true
language: en-US
reviews:
assess_linked_issues: true
auto_apply_labels: false
auto_review:
enabled: true
drafts: true
collapse_walkthrough: false
high_level_summary: true
high_level_summary_in_walkthrough: true
labeling_instructions: []
poem: false
profile: chill
request_changes_workflow: false
review_status: true
sequence_diagrams: false
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
bug_report.md
---

name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: ['bug']
assignees: ''

---

**Describe the bug**
Expand All @@ -22,7 +23,9 @@ Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.

**Are you going to work on fixing this?**
No.

- [ ] Yes
- [x] No

**Screenshots**
If applicable, add screenshots to help explain your problem.
Expand Down
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
labels: ['enhancement']
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand All @@ -16,5 +15,10 @@ A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Are you going to work on implementing this?**

- [ ] Yes
- [x] No

**Additional context**
Add any other context or screenshots about the feature request here.
37 changes: 37 additions & 0 deletions .github/workflows/label-issues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Auto Label Issues"
on:
issues:
types:
- edited
- opened

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Apply Labels to Issues
uses: actions/[email protected]
with:
script: |
const issue = context.payload.issue;
const keywords = {
"bug": ["error", "failure", "not working"],
"enhancement": ["add", "feature request", "improve"],
"question": ["clarification", "help", "how to"]
};
let labels = [];
for (const [label, words] of Object.entries(keywords)) {
if (words.some(word => issue.title.toLowerCase().includes(word) || issue.body.toLowerCase().includes(word))) {
labels.push(label);
}
}
if (labels.length > 0) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
labels: labels,
owner: context.repo.owner,
repo: context.repo.repo
});
}
38 changes: 25 additions & 13 deletions .github/workflows/run-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,37 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: poetry
cache: 'poetry'
cache-dependency-path: backend/poetry.lock
python-version: '3.13'

- name: Run pre-commit
uses: pre-commit/[email protected]

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: frontend/package-lock.json
cache: 'pnpm'
cache-dependency-path: frontend/pnpm-lock.yaml

- name: Install frontend dependencies
working-directory: frontend
run: npm install
run: pnpm install --frozen-lockfile

- name: Run npm format
- name: Run pnpm format
working-directory: frontend
run: npm run format
run: pnpm run format

- name: Run npm lint check
- name: Run pnpm lint check
working-directory: frontend
run: npm run lint:check
run: pnpm run lint:check

- name: Check for uncommitted changes
run: |
Expand Down Expand Up @@ -96,18 +102,24 @@ jobs:
with:
languages: ${{ matrix.language }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false

- name: Set up Node
if: matrix.language == 'javascript-typescript'
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: frontend/package-lock.json
cache: 'pnpm'
cache-dependency-path: frontend/pnpm-lock.yaml

- name: Install dependencies for frontend
if: matrix.language == 'javascript-typescript'
working-directory: frontend
run: npm install
run: pnpm install --frozen-lockfile

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
Expand Down Expand Up @@ -175,7 +187,7 @@ jobs:

- name: Run frontend unit tests
run: |
docker run --env-file frontend/.env.example ${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-frontend-unit:latest npm run test:unit
docker run --env-file frontend/.env.example ${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-frontend-unit:latest pnpm run test:unit
run-frontend-e2e-tests:
name: Run frontend e2e tests
Expand All @@ -201,7 +213,7 @@ jobs:

- name: Run frontend end-to-end tests
run: |
docker run --env-file frontend/.env.example ${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-frontend-e2e:latest npm run test:e2e
docker run --env-file frontend/.env.example ${{ env.DOCKERHUB_USERNAME }}/owasp-nest-test-frontend-e2e:latest pnpm run test:e2e
build-docker-staging-images:
name: Build Docker Staging Images
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ __pycache__
.idea
.local
.mypy_cache
.npm/
.pnpm-store/
.pytest_cache
.python_history
.python-version
Expand All @@ -18,7 +20,6 @@ venv/
*.log
backend/.venv
backend/staticfiles
frontend/.npm
frontend/blob-report/
frontend/coverage
frontend/dist
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- --format
- parsable
- --strict
exclude: .github
exclude: (.github|pnpm-lock.yaml)

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
Expand Down Expand Up @@ -35,6 +35,7 @@ repos:
- --mapping=2
- --offset=2
- --sequence=4
exclude: (.github|frontend/pnpm-lock.yaml)

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand Down
8 changes: 8 additions & 0 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ owasp-process-snapshots:
@echo "Processing OWASP snapshots"
@CMD="python manage.py owasp_process_snapshots" $(MAKE) exec-backend-command

owasp-update-project-health-metrics:
@echo "Updating OWASP project health requirements"
@CMD="python manage.py owasp_update_project_health_metrics" $(MAKE) exec-backend-command

owasp-update-project-health-requirements:
@echo "Updating OWASP project health metrics"
@CMD="python manage.py owasp_update_project_health_requirements" $(MAKE) exec-backend-command

owasp-scrape-chapters:
@echo "Scraping OWASP site chapters data"
@CMD="python manage.py owasp_scrape_chapters" $(MAKE) exec-backend-command
Expand Down
1 change: 1 addition & 0 deletions backend/apps/github/graphql/nodes/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Meta:
"author",
"comments_count",
"created_at",
"url",
"number",
"state",
"title",
Expand Down
4 changes: 4 additions & 0 deletions backend/apps/owasp/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from apps.owasp.models.committee import Committee
from apps.owasp.models.event import Event
from apps.owasp.models.project import Project
from apps.owasp.models.project_health_metrics import ProjectHealthMetrics
from apps.owasp.models.project_health_requirements import ProjectHealthRequirements
from apps.owasp.models.snapshot import Snapshot


Expand Down Expand Up @@ -141,4 +143,6 @@ class SnapshotAdmin(admin.ModelAdmin):
admin.site.register(Committee, CommitteeAdmin)
admin.site.register(Event, EventAdmin)
admin.site.register(Project, ProjectAdmin)
admin.site.register(ProjectHealthMetrics)
admin.site.register(ProjectHealthRequirements)
admin.site.register(Snapshot, SnapshotAdmin)
2 changes: 2 additions & 0 deletions backend/apps/owasp/graphql/nodes/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ class ProjectNode(GenericEntityNode):
issues_count = graphene.Int()
key = graphene.String()
languages = graphene.List(graphene.String)
level = graphene.String()
recent_issues = graphene.List(IssueNode)
recent_releases = graphene.List(ReleaseNode)
repositories = graphene.List(RepositoryNode)
repositories_count = graphene.Int()
topics = graphene.List(graphene.String)
type = graphene.String()

class Meta:
model = Project
Expand Down
Loading

0 comments on commit 5b4befc

Please sign in to comment.