Skip to content

Commit db564fa

Browse files
author
Ayush Jain
committed
publish
1 parent 72c58b5 commit db564fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+6079
-2351
lines changed

.github/labeler.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Labels for PR based on changed files
2+
3+
# Backend
4+
backend:
5+
- changed-files:
6+
- any-glob-to-any-file: 'backend/**'
7+
8+
rust:
9+
- changed-files:
10+
- any-glob-to-any-file: 'backend/**/*.rs'
11+
12+
# Frontend
13+
frontend:
14+
- changed-files:
15+
- any-glob-to-any-file: 'frontend/**'
16+
17+
typescript:
18+
- changed-files:
19+
- any-glob-to-any-file: 'frontend/**/*.{ts,tsx}'
20+
21+
styles:
22+
- changed-files:
23+
- any-glob-to-any-file: 'frontend/**/*.{css,scss}'
24+
25+
# Tests
26+
tests:
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- 'backend/tests/**'
30+
- 'frontend/tests/**'
31+
- '**/*.test.{ts,tsx}'
32+
- '**/*.spec.{ts,tsx}'
33+
34+
e2e:
35+
- changed-files:
36+
- any-glob-to-any-file: 'frontend/tests/e2e/**'
37+
38+
# CI/CD
39+
ci:
40+
- changed-files:
41+
- any-glob-to-any-file: '.github/**'
42+
43+
# Documentation
44+
documentation:
45+
- changed-files:
46+
- any-glob-to-any-file:
47+
- '**/*.md'
48+
- 'docs/**'
49+
50+
# Configuration
51+
config:
52+
- changed-files:
53+
- any-glob-to-any-file:
54+
- '*.toml'
55+
- '*.json'
56+
- '*.yml'
57+
- '*.yaml'
58+
- '.env*'
59+
60+
# Components
61+
components:
62+
- changed-files:
63+
- any-glob-to-any-file: 'frontend/src/components/**'
64+
65+
# Features
66+
feature:
67+
- changed-files:
68+
- any-glob-to-any-file: 'frontend/src/features/**'
69+
70+
# API
71+
api:
72+
- changed-files:
73+
- any-glob-to-any-file:
74+
- 'backend/src/api/**'
75+
- 'backend/src/presentation/**'
76+
77+
# Store/State
78+
state:
79+
- changed-files:
80+
- any-glob-to-any-file: 'frontend/src/store/**'

.github/workflows/auto-merge.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Auto Merge Dependabot PRs
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
auto-merge:
13+
name: Auto Merge
14+
runs-on: ubuntu-latest
15+
if: github.actor == 'dependabot[bot]'
16+
steps:
17+
- name: Dependabot metadata
18+
id: metadata
19+
uses: dependabot/fetch-metadata@v2
20+
with:
21+
github-token: "${{ secrets.GITHUB_TOKEN }}"
22+
23+
- name: Auto-merge minor and patch updates
24+
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
25+
run: gh pr merge --auto --squash "$PR_URL"
26+
env:
27+
PR_URL: ${{ github.event.pull_request.html_url }}
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Comment on major updates
31+
if: steps.metadata.outputs.update-type == 'version-update:semver-major'
32+
run: |
33+
gh pr comment "$PR_URL" --body "This is a **major version update**. Please review the changelog and breaking changes before merging."
34+
env:
35+
PR_URL: ${{ github.event.pull_request.html_url }}
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/benchmark.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Benchmarks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'backend/**'
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- 'backend/**'
12+
workflow_dispatch:
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
benchmark:
19+
name: Run Benchmarks
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: dtolnay/rust-toolchain@stable
24+
- uses: Swatinem/rust-cache@v2
25+
with:
26+
workspaces: backend
27+
28+
- name: Run benchmarks
29+
run: |
30+
if [ -f benches/*.rs ] || [ -d benches ]; then
31+
cargo bench --all-features -- --output-format bencher | tee benchmark-results.txt
32+
else
33+
echo "No benchmarks found"
34+
echo "No benchmarks configured" > benchmark-results.txt
35+
fi
36+
working-directory: backend
37+
continue-on-error: true
38+
39+
- name: Store benchmark result
40+
uses: benchmark-action/github-action-benchmark@v1
41+
with:
42+
tool: 'cargo'
43+
output-file-path: backend/benchmark-results.txt
44+
fail-on-alert: false
45+
alert-threshold: '150%'
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
auto-push: false
48+
comment-on-alert: true
49+
continue-on-error: true
50+
51+
compile-time:
52+
name: Compile Time Benchmark
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: dtolnay/rust-toolchain@stable
57+
- uses: Swatinem/rust-cache@v2
58+
with:
59+
workspaces: backend
60+
61+
- name: Clean build for timing
62+
run: cargo clean
63+
working-directory: backend
64+
65+
- name: Measure debug build time
66+
run: |
67+
echo "### Compile Time" >> $GITHUB_STEP_SUMMARY
68+
echo "" >> $GITHUB_STEP_SUMMARY
69+
START=$(date +%s)
70+
cargo build 2>&1
71+
END=$(date +%s)
72+
DEBUG_TIME=$((END - START))
73+
echo "- Debug build: ${DEBUG_TIME}s" >> $GITHUB_STEP_SUMMARY
74+
working-directory: backend
75+
76+
- name: Clean for release build
77+
run: cargo clean
78+
working-directory: backend
79+
80+
- name: Measure release build time
81+
run: |
82+
START=$(date +%s)
83+
cargo build --release 2>&1
84+
END=$(date +%s)
85+
RELEASE_TIME=$((END - START))
86+
echo "- Release build: ${RELEASE_TIME}s" >> $GITHUB_STEP_SUMMARY
87+
working-directory: backend
88+
89+
binary-size:
90+
name: Binary Size Check
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
- uses: dtolnay/rust-toolchain@stable
95+
- uses: Swatinem/rust-cache@v2
96+
with:
97+
workspaces: backend
98+
99+
- name: Build release binary
100+
run: cargo build --release
101+
working-directory: backend
102+
103+
- name: Report binary size
104+
run: |
105+
echo "### Binary Size" >> $GITHUB_STEP_SUMMARY
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
if [ -f target/release/stockmart ]; then
108+
SIZE=$(du -h target/release/stockmart | cut -f1)
109+
echo "- stockmart binary: $SIZE" >> $GITHUB_STEP_SUMMARY
110+
111+
# Check for size regression (example: warn if > 50MB)
112+
SIZE_BYTES=$(du -b target/release/stockmart | cut -f1)
113+
if [ "$SIZE_BYTES" -gt 52428800 ]; then
114+
echo "::warning::Binary size exceeds 50MB"
115+
fi
116+
else
117+
echo "Binary not found" >> $GITHUB_STEP_SUMMARY
118+
fi
119+
working-directory: backend

.github/workflows/cleanup.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Cleanup
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0' # Run every Sunday at midnight
6+
workflow_dispatch:
7+
8+
permissions:
9+
actions: write
10+
11+
jobs:
12+
cleanup-runs:
13+
name: Delete Old Workflow Runs
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Delete old workflow runs
17+
uses: Mattraks/delete-workflow-runs@v2
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
repository: ${{ github.repository }}
21+
retain_days: 30
22+
keep_minimum_runs: 10
23+
24+
cleanup-caches:
25+
name: Cleanup Caches
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Cleanup old caches
30+
uses: actions/github-script@v7
31+
with:
32+
script: |
33+
const caches = await github.rest.actions.getActionsCacheList({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
per_page: 100
37+
});
38+
39+
const thirtyDaysAgo = new Date();
40+
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
41+
42+
for (const cache of caches.data.actions_caches) {
43+
const lastAccessed = new Date(cache.last_accessed_at);
44+
if (lastAccessed < thirtyDaysAgo) {
45+
console.log(`Deleting cache: ${cache.key}`);
46+
await github.rest.actions.deleteActionsCacheById({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
cache_id: cache.id
50+
});
51+
}
52+
}
53+
54+
prune-images:
55+
name: Prune Old Artifacts
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Delete old artifacts
59+
uses: c-hive/gha-remove-artifacts@v1
60+
with:
61+
age: '30 days'
62+
skip-tags: true
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Dependency Review
2+
3+
on:
4+
pull_request:
5+
branches: [main, real-bid, real-bid-rust]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
dependency-review:
13+
name: Review Dependencies
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Dependency Review
18+
uses: actions/dependency-review-action@v4
19+
with:
20+
fail-on-severity: high
21+
deny-licenses: GPL-3.0, AGPL-3.0
22+
comment-summary-in-pr: always
23+
24+
license-check:
25+
name: License Compliance
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
cache: 'npm'
33+
cache-dependency-path: frontend/package-lock.json
34+
- name: Install dependencies
35+
run: npm ci
36+
working-directory: frontend
37+
- name: Check licenses
38+
run: npx license-checker --onlyAllow "MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;0BSD;CC0-1.0;Unlicense" --excludePrivatePackages
39+
working-directory: frontend
40+
continue-on-error: true

0 commit comments

Comments
 (0)