Skip to content

Commit

Permalink
updated scripts + pipline separation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishaan-Datta committed Sep 1, 2024
1 parent 95645bb commit c4f6b62
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 46 deletions.
46 changes: 1 addition & 45 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Checks for merging PR, includes linting
# Checks for merging PR, linting is currently disabled
name: Integration pipeline
run-name: Integration pipeline triggered by ${{ github.actor }}

Expand Down Expand Up @@ -73,37 +73,6 @@ jobs:
- name: Show environment variables
run: env

# - name: C++ lint
# uses: cpp-linter/cpp-linter-action@v2
# id: cpp_linter
# with:
# style: "file"
# tidy-checks: ""
# thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}

# - name: Lint with pylint
# run: |
# pylint --disable=C0301 --disable=C0326 *.py
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# - name: Check for linting errors
# id: lint-check
# run: |
# if [ -f lint-results.txt ]; then
# echo "Linting issues found"
# cat lint-results.txt
# exit 1
# else
# echo "No linting issues found"
# fi

# - name: Compile
# run: |
# cd /ros_ws
Expand All @@ -115,19 +84,6 @@ jobs:
# - name: Test run
# run: |
# ros2 run node_test jetson_node

- name: Update pull request
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
if [[ $(git status --porcelain) ]]; then
git add .
git commit -m "Auto-fix lint issues"
git push origin HEAD:${{ github.head_ref }}
else
echo "No lint fixes applied, nothing to commit."
fi

- run: echo ${{ github.event.inputs.delivery }}
- run: echo ${{ inputs.delivery }}
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Lints the code of a branch
name: Linting pipeline

on:
workflow_call:

jobs:
lint-cpp:
runs-on: self-hosted
permissions:
checks: write
pull-requests: write
id: cpp
steps:
- name: C++ lint
uses: cpp-linter/cpp-linter-action@v2
with:
style: "file"
tidy-checks: ""
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}

lint-python:
runs-on: self-hosted
permissions:
checks: write
pull-requests: write
id: python
steps:
- name: Lint with pylint
run: |
pylint --disable=C0301 --disable=C0326 *.py
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check for linting errors
id: lint-check
run: |
if [ -f lint-results.txt ]; then
echo "Linting issues found"
cat lint-results.txt
exit 1
else
echo "No linting issues found"
fi
update-pr:
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
if [[ $(git status --porcelain) ]]; then
git add .
git commit -m "Auto-fix lint issues"
git push origin HEAD:${{ github.head_ref }}
else
echo "No lint fixes applied, nothing to commit."
fi
# bug checks
# compilation
# linting/formatting
# Ament_flake8
# Ament_lint_cmake
# Ament_xmllint
# Black
# Clang-tidy
# Isort
3 changes: 2 additions & 1 deletion Experiments/Python POCs/benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
while jetson.ok() and count < args.duration * 60:
cpu_usage = jetson.cpu['total']['system'] + jetson.cpu['total']['user']
memory_usage = (jetson.memory['RAM']['used'] / jetson.memory['RAM']['tot']) * 100
gpu_usage = jetson.gpu['ga10b']['status']['load']
# gpu_usage = jetson.gpu['ga10b']['status']['load']
print(jetson.gpu)
cpu_temp = jetson.temperature['CPU']['temp']
gpu_temp = jetson.temperature['GPU']['temp']
gpu_mem = int(str(jetson.memory['RAM']['shared'])[:3])
Expand Down
47 changes: 47 additions & 0 deletions Misc Scripts/delete-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

# Delete all logs for a given workflow
# Usage: delete-logs.sh <repository> <workflow-name>

set -oe pipefail

REPOSITORY=$1
WORKFLOW_NAME=$2

# Validate arguments
if [[ -z "$REPOSITORY" ]]; then
echo "Repository is required"
exit 1
fi

if [[ -z "$WORKFLOW_NAME" ]]; then
echo "Workflow name is required"
exit 1
fi

echo "Getting all completed runs for workflow $WORKFLOW_NAME in $REPOSITORY"

RUNS=$(
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$REPOSITORY/actions/workflows/$WORKFLOW_NAME/runs" \
--paginate \
--jq '.workflow_runs[] | select(.conclusion != "") | .id'
)

echo "Found $(echo "$RUNS" | wc -l) completed runs for workflow $WORKFLOW_NAME"

# Delete logs for each run
for RUN in $RUNS; do
echo "Deleting logs for run $RUN"
gh api \
--silent \
--method DELETE \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$REPOSITORY/actions/runs/$RUN/logs" || echo "Failed to delete logs for run $RUN"

# Sleep for 100ms to avoid rate limiting
sleep 0.1
done

0 comments on commit c4f6b62

Please sign in to comment.