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

Infrastructure fixes #220

Merged
merged 23 commits into from
Feb 6, 2025
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
15 changes: 7 additions & 8 deletions .github/workflows/lines-of-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@ jobs:
- name: Run update script
run: |
function record {
cratePath=$1
crate_path=$1
name=$2

if [ -d "$cratePath/src" ] ; then
linesOfRustCode=$(scc -c --no-cocomo -f json -i rs "$cratePath/src" | jq '.[] | .Code');
if [ -d "$crate_path/src" ] ; then
lines_of_code=$(scc -c --no-cocomo -f json -i rs "$crate_path/src" | jq '.[] | .Code');
else
linesOfRustCode=$(scc -c --no-cocomo -f json -i rs "$cratePath" | jq '.[] | .Code');
lines_of_code=$(scc -c --no-cocomo -f json -i rs "$crate_path" | jq '.[] | .Code');
fi

echo "\`$name\` has $linesOfRustCode lines of code" >> $GITHUB_STEP_SUMMARY;
echo "\`$name\` has $lines_of_code 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;
--data "{\"project\":\"$name\",\"language\":\"rust\",\"loc\":$lines_of_code}" \
https://kaleidawave-projectinformation.web.val.run/update-project;
}

record "parser" "ezno-parser"
Expand Down
75 changes: 46 additions & 29 deletions .github/workflows/performance-and-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,37 @@ jobs:

- uses: brndnmtthws/rust-action-cargo-binstall@v1
with:
packages: hyperfine
packages: hyperfine ripgrep

- name: Install valgrind
run: sudo apt-get install valgrind

- name: Get last run
id: get-last-run
run: |
# First result should come up within 10 runs from main
id=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
'/repos/kaleidawave/ezno/actions/runs?branch=main&per_page=10' \
--jq '[.workflow_runs[] | select(.path == ".github/workflows/examples.yml")][0].id')
echo "run_id=$id" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}

- name: Build Ezno
run: cargo build --release
env:
CARGO_PROFILE_RELEASE_DEBUG: true

# TODO need to lookup existing workflow on main
# even if this worked, it might have issues with newer features added in this run
# - name: Get base ezno
# if: github.ref_name != 'main'
# uses: actions/download-artifact@v4
# continue-on-error: true
# with:
# name: latest-checker
# path: previous-ezno
- name: Get base ezno
if: github.ref_name != 'main'
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: latest-checker
path: previous-ezno
run-id: ${{ steps.get-last-run.outputs.run_id }}

- name: Set compilers
id: compilers
Expand Down Expand Up @@ -134,14 +146,14 @@ jobs:
shell: bash
if: github.ref_name != 'main'
run: |
echo "::group::Running all"
echo "::group::Running with staging"

cat ./checker/specification/specification.md ./checker/specification/staging.md > all.md
cargo run -p ezno-parser --example code_blocks_to_script all.md --comment-headers --out ./all.tsx
cat ./checker/specification/specification.md ./checker/specification/staging.md > with-staging.md
cargo run -p ezno-parser --example code_blocks_to_script with-staging.md --comment-headers --out ./with-staging.tsx

./target/release/ezno check all.tsx --timings || true
./target/release/ezno check with-staging.tsx --timings || true
./target/release/ezno check with-staging.tsx --timings || true

hyperfine -i -L compiler ${{ steps.compilers.outputs.BINARIES }} '{compiler} check all.tsx'
echo "::endgroup::"

- name: Run checker performance on large file
Expand All @@ -167,19 +179,24 @@ jobs:
run: |
IFS=',' read -ra ITEMS <<< ${{ steps.compilers.outputs.BINARIES }}

export RUST_BACKTRACE=1

for compiler in ${ITEMS[@]}; do
echo "::group::Running $compiler"

echo "::group::Callgrind"
valgrind --tool=callgrind --callgrind-out-file=cpu-out $compiler check demo.tsx | true
echo "CPU usage:"
head -n100 cpu-out
{
valgrind --tool=callgrind --callgrind-out-file=./cpu-out $compiler check demo.tsx --max-diagnostics 0
} || true
ls
echo "::notice::CPU usage:$(rg "summary: (.*)" -or '$1' -N --color never ./cpu_out)"
echo "::endgroup::"

echo "::group::Valgrind"
valgrind --log-file=memory-out $compiler check demo.tsx | true
echo "Memory usage:"
cat memory-out
{
valgrind --log-file=memory-out $compiler check demo.tsx --max-diagnostics 0
} || true
echo "::notice::Memory usage:$(rg "([0-9,]*) bytes allocated" -or '$1' -N --color never memory-out)"
echo "::endgroup::"

echo "::endgroup::"
Expand All @@ -205,10 +222,10 @@ jobs:
echo "::endgroup::"
done

# - name: Upload checker
# if: github.ref == 'main'
# uses: actions/upload-artifact@v4
# with:
# name: latest-checker
# path: target/release/ezno
# retention-days: 90
- name: Upload checker
if: github.ref == 'main'
uses: actions/upload-artifact@v4
with:
name: latest-checker
path: target/release/ezno
retention-days: 90
Loading
Loading