Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/scripts/public_loc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curl -X POST $1 \
-H 'Content-Type: application/json; charset=utf-8' \
--data "$(cat tooling/loc/loc_report_slack.txt)"
57 changes: 57 additions & 0 deletions .github/workflows/daily_loc_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Acknowledgement: This workflow is inspired by Ethrex Team (https://github.com/lambdaclass/ethrex)
name: Daily Lines of Code Report

on:
schedule:
# Every day at UTC midnight on weekdays
- cron: "0 0 * * 1,2,3,4,5"
workflow_dispatch:

permissions:
contents: read
actions: write

jobs:
loc:
name: Count loc and generate report
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Rust Environment
uses: ./.github/actions/setup-rust

- name: Restore cache
id: cache-loc-report
uses: actions/cache@v4
with:
path: tooling/loc/loc_report.json
key: loc-report-${{ github.ref_name }}
restore-keys: |
loc-report-

- name: Rename cached loc_report.json to loc_report.json.old
if: steps.cache-loc-report.outputs.cache-hit != ''
run: mv tooling/loc/loc_report.json tooling/loc/loc_report.json.old

- name: Generate the loc report
run: |
cd tooling/loc && make loc

- name: Save new loc_report.json to cache
if: success()
uses: actions/cache@v4
with:
path: tooling/loc/loc_report.json
key: loc-report-${{ github.ref_name }}

- name: Post results in summary
run: |
echo "# lines of code report" >> $GITHUB_STEP_SUMMARY
cat tooling/loc/loc_report_github.txt >> $GITHUB_STEP_SUMMARY

- name: Post results to Slack
env:
SLACK_WEBHOOK: ${{ secrets.LOC_SLACK_WEBHOOK }}
run: |
sh .github/scripts/publish_loc.sh "$SLACK_WEBHOOK"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/target
**/target
.idea
.vscode
Loading