Skip to content
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

add github actions workflows #65

Closed
wants to merge 111 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
3a6db8b
Merge pull request #17 from tenstorrent/staging
tstescoTT Jun 14, 2024
d62bbb3
add CONTRIBUTING.md to tt studio repo
anirudTT Sep 20, 2024
a30b964
Merge pull request #54 from tenstorrent/anirud/contributing.md
anirudTT Oct 23, 2024
9f2e377
Anirud/front end UI changes (#21)
anirudTT Aug 13, 2024
87e22c4
Anirud/license headers (#25)
anirudTT Sep 10, 2024
5b6bfde
Initial Backend Work
Aug 20, 2024
784edab
Adds depends_on for backend
Sep 5, 2024
a71d365
Changes PDF parsing to use plain strategy
Sep 6, 2024
8387cb1
Removes WIP prepopulate code
Sep 6, 2024
c45f783
Removes duplicate pyjwt dependency
Sep 6, 2024
a0f4954
Restores docker-compose.yml to match staging
Sep 6, 2024
966ed38
Adds singletons for Chroma client and embedding function
Sep 9, 2024
d3df180
Initializes Chroma/embed model in apps ready call
Sep 9, 2024
428b590
Updates views/chroma to use new singletons
Sep 9, 2024
a1b823a
Fixes base image version issue from rebase
Sep 11, 2024
1db8b6f
Fixes issue of first-run failure
Sep 11, 2024
f909190
Adds an up status endpoint
Sep 11, 2024
e5ae972
Adds service healthy check for backend API
Sep 11, 2024
098598a
Changes backend API healthcheck to be more tolerant
Sep 16, 2024
65925ca
Adds react-query, alert-dialog to packages
Sep 6, 2024
f0cd96a
Updates vite config to match TS config `@` alias
Sep 6, 2024
6c90555
Adds Axios functions for rag management
Sep 6, 2024
67b16d5
Adds react-query provider
Sep 6, 2024
9a91c31
Adds confirm dialog component
Sep 6, 2024
3c61bac
Adds form for creating new data source
Sep 6, 2024
b08f7d7
Adds route for RAG management
Sep 6, 2024
663e5ab
Adds page for managing RAG data sources
Sep 6, 2024
5fef88f
Adds data source selector to ChatComponent
Sep 6, 2024
a3d1dd6
Adds RAG management link to Navbar
Sep 6, 2024
355b879
Fixes import path to fetch collections function
Sep 6, 2024
4058802
Adds initial value for data source collections
Sep 6, 2024
db25ec9
Fixes TS errors in Vite config
Sep 9, 2024
e9c55ed
Fixes TS errors in existing components
Sep 9, 2024
79c38d4
Fixes Navbar after rebase
Sep 10, 2024
fec52cf
Changes table description to match existing table
Sep 10, 2024
34e4909
Updates package-lock.json
Sep 10, 2024
b9c61d4
Fixes missing list key error
Sep 10, 2024
c32872a
Adds header information to files
Sep 10, 2024
ebfc8a9
Updates button colors to match models deployed table
Sep 16, 2024
6924474
Change RAG data source form to text
Sep 16, 2024
37fc434
Adds help text for RAG management
Sep 16, 2024
30ce21a
Fixes consistence of 'datasource' spelling
Sep 16, 2024
bb70365
Adds colored buttons to Confirm Dialog
Sep 16, 2024
d53c60e
add rag_context to dummy_echo model for testing (#30)
tstescoTT Sep 17, 2024
6f2a5dc
Anirud/update license on rag components (#47)
anirudTT Sep 19, 2024
94b6d84
Anirud/re update license headers(#51)
anirudTT Sep 19, 2024
c87a29f
feat(NavBar): add tooltips and separators (#45)
anirudTT Sep 21, 2024
821a423
feat(chat-ui): update scroll behavior and UI enhancements (#46)
anirudTT Sep 21, 2024
85ffa39
add github actions workflows
anirudTT Oct 21, 2024
3c7212b
test - to not fail if es lint errors are found
anirudTT Oct 21, 2024
06b1ca4
test without lc header
anirudTT Oct 21, 2024
2ce7bce
try again
anirudTT Oct 21, 2024
05f9273
try to fail workflow
anirudTT Oct 21, 2024
9ca26d5
update comments
anirudTT Oct 21, 2024
7bd1f15
add more line spacing + update emoji
anirudTT Oct 21, 2024
79e3e29
update more comments
anirudTT Oct 21, 2024
bb80c69
rename both workflows
anirudTT Oct 21, 2024
7f271a8
check backend code as well if workflow works
anirudTT Oct 21, 2024
a34c38c
add config yaml file
anirudTT Oct 21, 2024
981ff17
check within models folder
anirudTT Oct 21, 2024
c89d751
update comments in frontend workflow
anirudTT Oct 21, 2024
099495f
more updates to comments
anirudTT Oct 21, 2024
c05f5e3
add back lc headers
anirudTT Oct 21, 2024
9f9b498
make it easier to spot lc header issues in frontend workflow comment
anirudTT Oct 21, 2024
84947eb
try displaying the files now
anirudTT Oct 21, 2024
422dc3d
try now
anirudTT Oct 21, 2024
7513210
remove any new line and trim
anirudTT Oct 21, 2024
feee16c
add back lc headers
anirudTT Oct 21, 2024
98f0148
update names on workflows
anirudTT Oct 21, 2024
ffbbab4
update comment header
anirudTT Oct 21, 2024
bb32775
ensure we are capturing all missing lc headers
anirudTT Oct 21, 2024
58a48ab
add lc header
anirudTT Oct 21, 2024
7f12cfb
add ESLint auto-fix and SPDX license check to workflow
anirudTT Oct 21, 2024
10823bf
add auto fix flag
anirudTT Oct 21, 2024
970f86d
borrow from tt buda demos workflows
anirudTT Oct 21, 2024
d4fd379
try not to fail
anirudTT Oct 21, 2024
7e0ebaa
*** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨***
anirudTT Oct 21, 2024
732f6eb
test without lc header
anirudTT Oct 21, 2024
0d8ddfc
*** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨***
anirudTT Oct 21, 2024
58b75a0
test both workflow for automated commits
anirudTT Oct 21, 2024
85aa360
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 21, 2024
070bca0
🚨✨ AUTOMATED COMMIT | Applied Code Formatting, Cleanup and added SPDX…
anirudTT Oct 21, 2024
fb9524d
try again
anirudTT Oct 21, 2024
7a3b75c
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 21, 2024
619dc97
add fixes to workflow and test
anirudTT Oct 21, 2024
975fb64
close the block
anirudTT Oct 21, 2024
23a14ef
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 21, 2024
dd50c61
test one more time
anirudTT Oct 21, 2024
648bbe6
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 21, 2024
ee24f28
🚨✨ AUTOMATED COMMIT | Applied Code Formatting, Cleanup and added SPDX…
anirudTT Oct 21, 2024
5954559
clean out es lint errors
anirudTT Oct 21, 2024
61dd696
correct License as per tt infernce changes:
anirudTT Oct 23, 2024
2da8395
add Dynamic Year Handling
anirudTT Oct 23, 2024
4e96d47
test again
anirudTT Oct 23, 2024
cee3875
try again with older workflow
anirudTT Oct 23, 2024
8715b8b
revert to commit:
anirudTT Oct 23, 2024
8852c62
revert back to tt buda demo version to check
anirudTT Oct 23, 2024
b1a18b6
check again
anirudTT Oct 23, 2024
9dc3acb
re add workflow with auto commit
anirudTT Oct 23, 2024
ed9fd58
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 23, 2024
f17fcd7
check if it doesnt work in empty init files
anirudTT Oct 23, 2024
8b57450
check on docker file
anirudTT Oct 23, 2024
b65b33f
try new workflow which runs on all files checkout
anirudTT Oct 23, 2024
c129370
correct path to pythons script
anirudTT Oct 23, 2024
b5a015e
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 23, 2024
3cc5830
try this new workflow
anirudTT Oct 23, 2024
a73978b
add old workflow + run script second time + test
anirudTT Oct 23, 2024
8929f5a
remove lc header from model utils.py
anirudTT Oct 23, 2024
9a79974
🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically
anirudTT Oct 23, 2024
7436b5f
test docker file + empty init file
anirudTT Oct 23, 2024
4875c3b
🚨✨AUTOMATED COMMIT | Final SPDX license header additions
anirudTT Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions .github/workflows/backend-license-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Backend-Models SPDX Licenses Checker

on:
workflow_dispatch:
workflow_call:
pull_request:
branches:
- "main"
- "staging"
types:
- opened
- reopened
- synchronize
- assigned
- review_requested

jobs:
check-spdx-licenses:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- uses: actions/[email protected]
with:
cache: "pip"
python-version: "3.8"

# Install the copyright checking tool
- name: Install copyright check tool
run: pip install git+https://github.com/espressif/check-copyright.git@master

# Check SPDX licenses
- name: Check SPDX licenses
id: check_spdx_licenses
run: |
set +e
output=$(python -m check_copyright --verbose --dry-run --config ./check_copyright_config.yaml . 2>&1)
exit_code=$?
clean_output=$(echo "$output" | sed 's/\x1b\[[0-9;]*m//g')
echo "CLEAN_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$clean_output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "EXIT_CODE=$exit_code" >> $GITHUB_ENV
exit 0

- name: Debug Extracted Files
run: |
echo "Extracted Files:"
echo "$CLEAN_OUTPUT"

# Extract files needing SPDX header addition
- name: Extract Files
id: extract_files
run: |
set +e
files=$(echo "$CLEAN_OUTPUT" | awk '
/Files which failed the copyright check:/, /Additional information about this hook and copyright headers may be found here:/ {
if ($0 !~ /Files which failed the copyright check:/ && $0 !~ /Additional information about this hook and copyright headers may be found here:/) print
}
/Some files are without a copyright note and a license header needs to be added:/, /Additional information about this hook and copyright headers may be found here:/ {
if ($0 !~ /Some files are without a copyright note and a license header needs to be added:/ && $0 !~ /Additional information about this hook and copyright headers may be found here:/) print
}' | sed 's/^ *//' | sed '/^$/d' | grep '^.')
echo "FILES<<EOF" >> $GITHUB_ENV
echo "$files" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Extracted Files: $files"
exit 0

- name: Debug Extracted Files
run: |
echo "Extracted Files:"
echo "$FILES"

# Run the `add_spdx_header.py` script to fix missing SPDX headers
- name: Run SPDX Header Script
if: env.FILES != ''
run: |
set +e
python add_spdx_header.py # Run the script to add SPDX headers to the missing files
exit 0

# Commit the changes made by `add_spdx_header.py`
- name: Commit changes
if: env.FILES != ''
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: SPDX-Bot
commit_user_email: [email protected]
commit_message: '🚨✨AUTOMATED COMMIT | Added missing SPDX license headers automatically'
branch: ${{ github.head_ref }}

# Extract and clean file paths
- name: Extract File Paths
if: env.FILES != ''
run: |
files_clean=$(echo "$FILES" | awk '/^Modified files:/ {ignore = 1} /^Above is a list of files/ {ignore = 0} !ignore && /^\.\// {print}' | sort | uniq)
echo "FILES_CLEAN<<EOF" >> $GITHUB_ENV
echo "$files_clean" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Extracted Paths: $files_clean"

- name: Debug Extracted Paths
run: |
echo "Extracted Paths:"
echo "$FILES_CLEAN"
echo "---------------------------------"

# Post a comment on the PR or Issue if there are SPDX issues
- name: Comment on PR or Issue
if: env.FILES_CLEAN != ''
uses: actions/github-script@v7
with:
script: |
const formattedOutput = process.env.FILES_CLEAN;
const issueNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
if (formattedOutput) {
const commentBody = `Our automated SPDX license verification process has discovered that the following files are missing a license header:\n\`\`\`\n${formattedOutput}\n\`\`\`\nPlease ensure each indicated file includes a valid SPDX license identifier. This is essential for maintaining licensing compliance. Thank you.`;
await github.rest.issues.createComment({
issue_number: issueNumber,
owner: owner,
repo: repo,
body: commentBody
});
} else {
console.log("No SPDX license issues found.");
}

- name: Run SPDX Header Script Again
run: |
set +e
echo "Running SPDX header script again on all files in the repository"
python ./add_spdx_header.py
exit 0

# Commit the changes made by the second run of `add_spdx_header.py`
- name: Commit changes from second run
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: SPDX-Bot
commit_user_email: [email protected]
commit_message: '🚨✨AUTOMATED COMMIT | Final SPDX license header additions'
branch: ${{ github.head_ref }}
176 changes: 176 additions & 0 deletions .github/workflows/frontend-lint-license-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: Front-End Linter SPDX Licenses Checker

on:
push:
branches:
- main
pull_request:
branches:
- "main"
- "staging"
types:
- opened
- reopened
- synchronize
- assigned
- review_requested

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
working-directory: app/frontend
run: npm install

- name: Run ESLint with Auto-fix
working-directory: app/frontend
run: |
set +e
npm run lint || true # Run lint and allow the workflow to continue even if there are warnings/errors

# Check if GPG key exists
- name: Check if GPG key exists
run: |
if [ -n "${{ secrets.GPG_PRIVATE_KEY }}" ]; then
echo "GPG_KEY_EXISTS=true" >> $GITHUB_ENV
else
echo "GPG_KEY_EXISTS=false" >> $GITHUB_ENV
fi

# Import GPG key if it exists
- name: Import GPG key if it exists
if: env.GPG_KEY_EXISTS == 'true'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

# Auto-commit changes using stefanzweifel/git-auto-commit-action
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_user_name: CleanBot
commit_user_email: [email protected]
commit_message: '🚨✨ AUTOMATED COMMIT | Applied Code Formatting, Cleanup and added SPDX license headers'
commit_options: ${{ env.GPG_KEY_EXISTS == 'true' && '-S' || '' }}
branch: ${{ github.head_ref }}

# Run ESLint and Capture Output
- name: Run ESLint and Capture Output
working-directory: app/frontend
id: run_eslint
run: |
set +e
output=$(npm run lint --silent 2>&1)
exit_code=$?
echo "$output"
clean_output=$(echo "$output" | sed 's/\x1b\[[0-9;]*m//g') # Remove ANSI escape codes
echo "CLEAN_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$clean_output" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

grouped_errors=""
current_file=""
errors_for_file=""
has_errors=false
missing_lc_headers=false
lc_flagged_files=""

while IFS= read -r line; do
if echo "$line" | grep -q '^\s*\/'; then
if [ "$has_errors" = true ]; then
grouped_errors+="$current_file\n$errors_for_file\n------------------------------------------------------------------------------------------------------------------------------------------\n"
errors_for_file=""
has_errors=false
fi
current_file=$(echo "$line" | sed 's/\n//g')
elif echo "$line" | grep -q 'error'; then
errors_for_file+=" $line\n"
has_errors=true

if echo "$line" | grep -q 'missing header'; then
missing_lc_headers=true
errors_for_file+="!Flagged: LC header missing\n"
lc_flagged_files+="${current_file}\n"
fi
fi
done <<< "$clean_output"

if [ "$has_errors" = true ]; then
grouped_errors+="$current_file\n$errors_for_file\n"
fi

if [ -n "$grouped_errors" ]; then
echo "Errors found."
echo "GROUPED_ERRORS<<EOF" >> $GITHUB_ENV
echo -e "$grouped_errors" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "HAS_ERRORS=true" >> $GITHUB_ENV
else
echo "No relevant errors found."
echo "HAS_ERRORS=false" >> $GITHUB_ENV
fi

if [ "$missing_lc_headers" = true ]; then
echo "LC headers missing in one or more files."
echo "MISSING_LC_HEADERS=true" >> $GITHUB_ENV
echo "LC_FLAGGED_FILES<<EOF" >> $GITHUB_ENV
echo -e "$(echo -e "$lc_flagged_files" | sed '/^\s*$/d')" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "MISSING_LC_HEADERS=false" >> $GITHUB_ENV
fi

exit 0

# Comment on PR with ESLint Errors and LC Headers
- name: Comment on PR with ESLint Errors and LC Headers
if: env.HAS_ERRORS == 'true'
uses: actions/github-script@v7
with:
script: |
const lintErrors = process.env.GROUPED_ERRORS;
const issueNumber = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;

let commentBody = "";

if (process.env.MISSING_LC_HEADERS === 'true') {
const flaggedFiles = process.env.LC_FLAGGED_FILES.trim();
commentBody += `## 🚨 SPDX-License Header Errors\n\nThe following files are missing the required license headers:\n\n\`\`\`\n${flaggedFiles}\n\`\`\`\nPlease ensure each of these files includes a valid SPDX license identifier. This is essential for maintaining licensing compliance. Thank you!`;
}

if (lintErrors) {
commentBody += `## Frontend Project: ESLint Errors\n\`\`\`\n${lintErrors}\n\`\`\`\nPlease review and resolve the ESLint errors.`;
}

if (commentBody.trim() && issueNumber) {
await github.rest.issues.createComment({
issue_number: issueNumber,
owner: owner,
repo: repo,
body: commentBody
});
} else {
console.log("No relevant errors to report.");
}
- name: Fail the Workflow if LC Headers Are Missing
if: env.MISSING_LC_HEADERS == 'true'
run: |
echo "Failing the workflow because LC headers are missing."
exit 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ db.sqlite3

# unignore
!requirements.txt
!app/frontend/third-party-licenses.txt
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Contributing to TT-STUDIO

Thank you for your interest in this project! We want to make contributing as easy and transparent as possible.

If you're interested in making a contribution, please familiarize yourself with our technical [contribution standards](#contribution-standards) outlined in this guide.

Next, request the appropriate write permissions by [opening an issue](https://github.com/tenstorrent/tt-studio/issues/new/choose) for GitHub permissions.

All contributions require:

- An issue:
- Please file a feature request or bug report under the Issues section to help get the attention of a maintainer.
- A pull request (PR).
- Your PR must be approved by the appropriate reviewers.

## Contribution Standards

### Code Reviews

We actively welcome your pull requests! To ensure quality contributions, any code change must meet the following criteria:

- A PR must be opened and approved by:
- A maintaining team member.
- Any codeowners whose modules are relevant to the PR.
- Run pre-commit hooks.
- Pass all acceptance criteria mandated in the original issue.
- Pass the automated GitHub Actions workflow tests.
- Pass any testing requirements specified by the relevant codeowners.

### Pull Request Guidelines

- All PRs must first be merged into the `staging` branch. We use a squash merge strategy for this, meaning that all the individual commits from a feature branch are combined into a single commit when merged. This simplifies the commit history, ensuring that the feature is tracked as a single change while keeping the repository clean and manageable.

- When merging from `staging` into `main`, we do **not** use squashing. This ensures that the full commit history between these branches is preserved.

Please ensure that this process is followed when submitting PRs to keep the repository organized and maintainable.
Loading