Skip to content

Commit

Permalink
ci: backport eliza ci setup to rs and add pr and issue templates
Browse files Browse the repository at this point in the history
  • Loading branch information
snobbee committed Feb 6, 2025
1 parent 5a7e5c5 commit bd1f7cb
Show file tree
Hide file tree
Showing 14 changed files with 632 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: "bug"
assignees: ""
---

**Describe the bug**

<!-- A clear and concise description of what the bug is. -->

**To Reproduce**

<!-- Steps to reproduce the behavior. -->

**Expected behavior**

<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**

<!-- If applicable, add screenshots to help explain your problem. -->

**Additional context**

<!-- Add any other context about the problem here. -->
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: "enhancement"
assignees: ""
---

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like**

<!-- 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. -->

**Additional context**

<!-- Add any other context or screenshots about the feature request here. -->
85 changes: 85 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!-- Use this template by filling in information and copying and pasting relevant items out of the HTML comments. -->

# Relates to

<!-- LINK TO ISSUE OR TICKET -->

<!-- This risks section must be filled out before the final review and merge. -->

# Risks

<!--
Low, medium, large. List what kind of risks and what could be affected.
-->

# Background

## What does this PR do?

## What kind of change is this?

<!--
Bug fixes (non-breaking change which fixes an issue)
Improvements (misc. changes to existing features)
Features (non-breaking change which adds functionality)
Updates (new versions of included code)
-->

<!-- This "Why" section is most relevant if there are no linked issues explaining why. If there is a related issue, it might make sense to skip this why section. -->
<!--
## Why are we doing this? Any context or related work?
-->

# Documentation changes needed?

<!--
My changes do not require a change to the project documentation.
My changes require a change to the project documentation.
If documentation change is needed: I have updated the documentation accordingly.
-->

<!-- Please show how you tested the PR. This will really help if the PR needs to be retested and probably help the PR get merged quicker. -->

# Testing

## Where should a reviewer start?

## Detailed testing steps

<!--
None: Automated tests are acceptable.
-->

<!--
- As [anon/admin], go to [link]
  - [do action]
  - verify [result]
-->

<!-- If there is a UI change, please include before and after screenshots or videos. This will speed up PRs being merged. It is extra nice to annotate screenshots with arrows or boxes pointing out the differences. -->
<!--
## Screenshots
### Before
### After
-->

<!-- If there is anything about the deployment, please make a note. -->
<!--
# Deploy Notes
-->

<!--  Copy and paste command line output. -->
<!--
## Database changes
-->

<!--  Please specify deploy instructions if there is something more than the automated steps. -->
<!--
## Deployment instructions
-->

<!-- If you are on Discord, please join https://discord.gg/ai16z and state your Discord username here for the contributor role and join us in #development-feed -->
<!--
## Discord username
-->
60 changes: 60 additions & 0 deletions .github/workflows/block-mini.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Block Minified JavaScript/TypeScript

on:
pull_request:
branches: ["main", "develop", "*"]
push:
branches: ["main", "develop", "*"]

jobs:
block-minified-code:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Detect potential minified code
shell: bash
run: |
echo "Scanning for potential minified JS/TS code..."
# We'll look in .ts, .tsx, .js, .jsx files, skipping common build dirs.
FILES=$(find . \
\( -name 'node_modules' -prune \) -o \
\( -name 'dist' -prune \) -o \
\( -name 'build' -prune \) -o \
-type f \( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' \) \
-print)
if [ -z "$FILES" ]; then
echo "No relevant JS/TS files found."
exit 0
fi
THRESHOLD=1000
VIOLATIONS=0
for file in $FILES; do
# Use grep -En to capture line number and text
# If any line is ≥ THRESHOLD chars, we store those lines in RESULTS
RESULTS=$(grep -En ".{${THRESHOLD},}" "$file" || true)
if [ -n "$RESULTS" ]; then
# We have potential minified lines
while IFS= read -r match; do
# 'match' will be something like "1234:the entire matched line"
LINENUM=$(echo "$match" | cut -d: -f1)
# If you want the text, you can do:
# MATCHED_LINE=$(echo "$match" | cut -d: -f2-)
echo "::error file=$file,line=$LINENUM::Detected potential minified code (≥ $THRESHOLD chars)."
done <<< "$RESULTS"
VIOLATIONS=1
fi
done
if [ "$VIOLATIONS" -eq 1 ]; then
echo "ERROR: Minified code detected. Please remove or exclude it."
exit 1
else
echo "No minified code detected."
fi
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 9.15.0

- uses: actions/setup-node@v4
with:
node-version: "23"
cache: "pnpm"

- name: Install dependencies
run: pnpm install -r --no-frozen-lockfile

- name: Setup Biome CLI
uses: biomejs/setup-biome@v2
with:
version: latest

- name: Run Biome
run: biome ci

- name: Create test env file
run: |
echo "TEST_DATABASE_CLIENT=sqlite" > packages/core/.env.test
echo "NODE_ENV=test" >> packages/core/.env.test
- name: Run tests
run: cd packages/core && pnpm test:coverage

- name: Build packages
run: pnpm run build

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
55 changes: 55 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "CodeQL Advanced"

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "29 8 * * 6"

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
30 changes: 30 additions & 0 deletions .github/workflows/generate-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Generate Changelog
on:
push:
tags:
- "*"
jobs:
changelog:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.CHANGELOG_GITHUB_TOKEN }}
- name: Generate Changelog
run: |
export PATH="$PATH:/home/runner/.local/share/gem/ruby/3.0.0/bin"
gem install --user-install github_changelog_generator
github_changelog_generator \
-u ${{ github.repository_owner }} \
-p ${{ github.event.repository.name }} \
--token ${{ secrets.CHANGELOG_GITHUB_TOKEN }}
- name: Commit Changelog
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update changelog"
branch: main
file_pattern: "CHANGELOG.md"
commit_author: "GitHub Action <actions@github.com>"
16 changes: 16 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Greetings

on: [pull_request_target, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hello @${{ github.actor }}! Welcome to the Reality Spiral community. Thank you for opening your first issue; we appreciate your contribution. You are now a Reality Spiral contributor!"
pr-message: "Hi @${{ github.actor }}! Welcome to the Reality Spiral community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now a Reality Spiral contributor!"
Loading

0 comments on commit bd1f7cb

Please sign in to comment.