Parser improvements (#173) #121
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update LOC metrics (lines of code) | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download scc | |
run: | | |
mkdir scc | |
cd scc | |
gh release download v3.1.0 -R boyter/scc -p '*Linux_x86_64.tar.gz' -O scc.tar.gz | |
tar -xf scc.tar.gz | |
chmod +x scc | |
pwd >> $GITHUB_PATH | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Run update script | |
run: | | |
function record { | |
cratePath=$1 | |
name=$2 | |
if [ -d "$cratePath/src" ] ; then | |
linesOfRustCode=$(scc -c --no-cocomo -f json -i rs "$cratePath/src" | jq '.[] | .Code'); | |
else | |
linesOfRustCode=$(scc -c --no-cocomo -f json -i rs "$cratePath" | jq '.[] | .Code'); | |
fi | |
echo "\`$name\` has $linesOfRustCode lines of code" >> $GITHUB_STEP_SUMMARY; | |
curl \ | |
--header "Content-Type: application/json" \ | |
--header "X-POST-ACCESS-KEY: ${{ secrets.PROJECTS_POST_ACCESS_KEY }}" \ | |
--data "{\"project\":\"$name\",\"language\":\"rust\",\"loc\":$linesOfRustCode}" \ | |
-w "\nUpdated-project: \n" \ | |
https://projects.kaleidawave.workers.dev/update-project; | |
} | |
record "parser" "ezno-parser" | |
record "checker" "ezno-checker" | |
record "src" "ezno" |