From b05e4ba89c5ba7cba812c325789c8c6f0854e2b1 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Mon, 26 Aug 2024 03:02:54 +0545 Subject: [PATCH 01/13] feat(CI): add workflow for generating compile time information --- .github/workflows/CompileTimeDelta.yml | 41 ++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/CompileTimeDelta.yml diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml new file mode 100644 index 000000000..f6ed1f714 --- /dev/null +++ b/.github/workflows/CompileTimeDelta.yml @@ -0,0 +1,41 @@ +name: Save cargo build timing information + +on: [push, pull_request] + +jobs: + linux-ubuntu: + name: Add build timing information to another repository + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always + + # regarding the caching of build files, for now i've decided we are building fresh + steps: + - name: Checkout main repo + uses: actions/checkout@v4 + with: + path: debate-map + - name: Build Timing + working-directory: debate-map + run: cargo build --package app-server --timings + + - name: Checkout compile timings repo + uses: actions/checkout@v4 + with: + repository: rishadbaniya/compile-timings # TODO: change this to debate-map/compile-timings after testing is done + path : compile-timings + token : ${{ secrets.PAT }} + + - name: Copy timing file (with timestamp) to target repository + run: | + mkdir -p compile-timings/timings + mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/ + + - name: Commit and push changes + working-directory: compile-timings + run: | + git config user.name "compile-timings[bot]" # TODO: change the username and email here after testing + git config user.email rbdroid01@gmail.com + git add timings + git commit -m "ci: add build timing information for app-server" + git push From 450d4582897a30d7abc76fd8281334f17b118cc6 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Mon, 26 Aug 2024 03:08:56 +0545 Subject: [PATCH 02/13] refactor(CI): replace test repositories with debate-map repo --- .github/workflows/CompileTimeDelta.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index f6ed1f714..bfbe9a7a0 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -22,7 +22,7 @@ jobs: - name: Checkout compile timings repo uses: actions/checkout@v4 with: - repository: rishadbaniya/compile-timings # TODO: change this to debate-map/compile-timings after testing is done + repository: debate-map/compile-timings path : compile-timings token : ${{ secrets.PAT }} @@ -34,8 +34,8 @@ jobs: - name: Commit and push changes working-directory: compile-timings run: | - git config user.name "compile-timings[bot]" # TODO: change the username and email here after testing - git config user.email rbdroid01@gmail.com + git config user.name "compile-timings[bot]" + git config user.email debatemap@gmail.com git add timings git commit -m "ci: add build timing information for app-server" git push From a652c97ea1962122709a8328f7c820d0eefaa665 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sun, 6 Oct 2024 13:34:05 +0545 Subject: [PATCH 03/13] ci: put build html in timings/raw_html folder rather than timings --- .github/workflows/CompileTimeDelta.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index bfbe9a7a0..02399f1e6 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -26,10 +26,18 @@ jobs: path : compile-timings token : ${{ secrets.PAT }} - - name: Copy timing file (with timestamp) to target repository + - name: Create required directories & copy raw timing file (with the timestamp in it's name) to target repository's timings/raw_html directory run: | - mkdir -p compile-timings/timings - mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/ + mkdir -p compile-timings/timings/raw_html + mkdir -p compile-timings/timings/build_metadatas/ + mkdir -p compile-timings/timings/build_units/ + mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/raw_html + + #- name: Extract compile timing information from any new raw build timing html file that's not in tracker.json and add them to build_metadatas & build_units + #working-directory: debate-map/compile-timings/compile-timings-extractor + #run: | + ##mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/ + #cargo run -- --input-file ../timings/cargo-timing-20240825T213151Z.html --tracker-file ./tracker.json --metadata-dir ./hey --units-data-dir ./hehe - name: Commit and push changes working-directory: compile-timings From 6aa42d14cc9fe8e361a93b814dcfe71a8e5c666b Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sun, 6 Oct 2024 13:57:06 +0545 Subject: [PATCH 04/13] ci: add support for file name in commit message --- .github/workflows/CompileTimeDelta.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 02399f1e6..3428d7d7a 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -45,5 +45,6 @@ jobs: git config user.name "compile-timings[bot]" git config user.email debatemap@gmail.com git add timings - git commit -m "ci: add build timing information for app-server" + NEW_BUILD_HTML_FILE=$(ls -t timings/raw_html/ | head -n1) + git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE and it's extracted json files" git push From 5bf58ee294dc4fa64ae196dccbddb746776cd9c7 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sun, 6 Oct 2024 14:09:34 +0545 Subject: [PATCH 05/13] ci: add json extraction and tracker.json usage --- .github/workflows/CompileTimeDelta.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 3428d7d7a..465449c0d 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -33,11 +33,11 @@ jobs: mkdir -p compile-timings/timings/build_units/ mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/raw_html - #- name: Extract compile timing information from any new raw build timing html file that's not in tracker.json and add them to build_metadatas & build_units - #working-directory: debate-map/compile-timings/compile-timings-extractor - #run: | - ##mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/ - #cargo run -- --input-file ../timings/cargo-timing-20240825T213151Z.html --tracker-file ./tracker.json --metadata-dir ./hey --units-data-dir ./hehe + - name: Extract compile timing information from any new raw build timing html file that's not in tracker.json and add them to build_metadatas & build_units + working-directory: compile-timings/compile-timings-extractor + run: | + NEW_BUILD_HTML_FILE=$(ls -t ../timings/raw_html/ | head -n1) + cargo run -- --input-file ../timings/raw_html/$NEW_BUILD_HTML_FILE --tracker-file ../timings/tracker.json --metadata-dir ../timings/build_metadatas --units-data-dir ../timings/build_units - name: Commit and push changes working-directory: compile-timings From 1f3059c2b2af4c76cdbca39a74afb10aa42ad33f Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sun, 6 Oct 2024 14:23:29 +0545 Subject: [PATCH 06/13] ci: change working directory --- .github/workflows/CompileTimeDelta.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 465449c0d..3b1bdddb5 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -34,9 +34,10 @@ jobs: mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/raw_html - name: Extract compile timing information from any new raw build timing html file that's not in tracker.json and add them to build_metadatas & build_units - working-directory: compile-timings/compile-timings-extractor + working-directory: compile-timings run: | - NEW_BUILD_HTML_FILE=$(ls -t ../timings/raw_html/ | head -n1) + NEW_BUILD_HTML_FILE=$(ls -t timings/raw_html/ | head -n1) + cd compile_timing_extractor cargo run -- --input-file ../timings/raw_html/$NEW_BUILD_HTML_FILE --tracker-file ../timings/tracker.json --metadata-dir ../timings/build_metadatas --units-data-dir ../timings/build_units - name: Commit and push changes From e65ba76194a2d36d035d942533f69e48e651d2b7 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sun, 6 Oct 2024 14:34:08 +0545 Subject: [PATCH 07/13] ci: remove extraction of data out of build html files --- .github/workflows/CompileTimeDelta.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 3b1bdddb5..38b96223b 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -9,7 +9,6 @@ jobs: env: CARGO_TERM_COLOR: always - # regarding the caching of build files, for now i've decided we are building fresh steps: - name: Checkout main repo uses: actions/checkout@v4 @@ -29,17 +28,8 @@ jobs: - name: Create required directories & copy raw timing file (with the timestamp in it's name) to target repository's timings/raw_html directory run: | mkdir -p compile-timings/timings/raw_html - mkdir -p compile-timings/timings/build_metadatas/ - mkdir -p compile-timings/timings/build_units/ mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/raw_html - - name: Extract compile timing information from any new raw build timing html file that's not in tracker.json and add them to build_metadatas & build_units - working-directory: compile-timings - run: | - NEW_BUILD_HTML_FILE=$(ls -t timings/raw_html/ | head -n1) - cd compile_timing_extractor - cargo run -- --input-file ../timings/raw_html/$NEW_BUILD_HTML_FILE --tracker-file ../timings/tracker.json --metadata-dir ../timings/build_metadatas --units-data-dir ../timings/build_units - - name: Commit and push changes working-directory: compile-timings run: | @@ -47,5 +37,5 @@ jobs: git config user.email debatemap@gmail.com git add timings NEW_BUILD_HTML_FILE=$(ls -t timings/raw_html/ | head -n1) - git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE and it's extracted json files" + git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE" git push From 77eafba7165fd573946e55ef6b1ebec4125a2495 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sun, 6 Oct 2024 22:36:25 +0545 Subject: [PATCH 08/13] ci: change root for timings directory --- .github/workflows/CompileTimeDelta.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 38b96223b..e0b787fb4 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -27,15 +27,15 @@ jobs: - name: Create required directories & copy raw timing file (with the timestamp in it's name) to target repository's timings/raw_html directory run: | - mkdir -p compile-timings/timings/raw_html - mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/timings/raw_html + mkdir -p compile-timings/docs/timings/raw_html + mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/docs/timings/raw_html - name: Commit and push changes working-directory: compile-timings run: | git config user.name "compile-timings[bot]" git config user.email debatemap@gmail.com - git add timings - NEW_BUILD_HTML_FILE=$(ls -t timings/raw_html/ | head -n1) + git add docs/timings/raw_html + NEW_BUILD_HTML_FILE=$(ls -t docs/timings/raw_html/ | head -n1) git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE" git push From a5acca61d6d7338fde432308f13e87f209a05de0 Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Fri, 1 Nov 2024 18:56:42 +0545 Subject: [PATCH 09/13] ci: add hash in the suffix of html file as well --- .github/workflows/CompileTimeDelta.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index e0b787fb4..a1118af4b 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -18,6 +18,10 @@ jobs: working-directory: debate-map run: cargo build --package app-server --timings + - name: Get commit hash + working-directory: debate-map + run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + - name: Checkout compile timings repo uses: actions/checkout@v4 with: @@ -28,7 +32,9 @@ jobs: - name: Create required directories & copy raw timing file (with the timestamp in it's name) to target repository's timings/raw_html directory run: | mkdir -p compile-timings/docs/timings/raw_html - mv debate-map/target/cargo-timings/cargo-timing-* compile-timings/docs/timings/raw_html + for file in debate-map/target/cargo-timings/cargo-timing-*.html; do + mv "$file" "compile-timings/docs/timings/raw_html/$(basename "$file" .html)_${{ env.COMMIT_HASH }}.html" + done - name: Commit and push changes working-directory: compile-timings From 14ecf1e9f8935ea20349007e081a3daf9b542d3d Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Fri, 1 Nov 2024 23:02:24 +0545 Subject: [PATCH 10/13] ci: add hash in the commit message too --- .github/workflows/CompileTimeDelta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index a1118af4b..bf391df14 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -43,5 +43,5 @@ jobs: git config user.email debatemap@gmail.com git add docs/timings/raw_html NEW_BUILD_HTML_FILE=$(ls -t docs/timings/raw_html/ | head -n1) - git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE" + git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE_${{ env.COMMIT_HASH }}" git push From 235ab7a8d7d611870e6f1b3dd08d73ac2a3deecb Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Fri, 1 Nov 2024 23:11:12 +0545 Subject: [PATCH 11/13] ci: revert back to using only env variable to denote file name --- .github/workflows/CompileTimeDelta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index bf391df14..98e56af36 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -43,5 +43,5 @@ jobs: git config user.email debatemap@gmail.com git add docs/timings/raw_html NEW_BUILD_HTML_FILE=$(ls -t docs/timings/raw_html/ | head -n1) - git commit -m "ci: add build timing html file $NEW_BUILD_HTML_FILE_${{ env.COMMIT_HASH }}" + git commit -m "ci: add build timing html $NEW_BUILD_HTML_FILE" git push From 5f0a4eeedccdd4765e424e6d76c978ce4f2f146c Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Sat, 2 Nov 2024 15:51:30 +0545 Subject: [PATCH 12/13] chore: rename step to copy timing build html --- .github/workflows/CompileTimeDelta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 98e56af36..86ccf5d91 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -29,7 +29,7 @@ jobs: path : compile-timings token : ${{ secrets.PAT }} - - name: Create required directories & copy raw timing file (with the timestamp in it's name) to target repository's timings/raw_html directory + - name: Copy raw timing files to target repo run: | mkdir -p compile-timings/docs/timings/raw_html for file in debate-map/target/cargo-timings/cargo-timing-*.html; do From c9a9d13fbf1e779a4c3a7d7e7a426dab990d29ea Mon Sep 17 00:00:00 2001 From: rishadbaniya Date: Mon, 24 Mar 2025 14:58:54 +0545 Subject: [PATCH 13/13] ci: use the package name app_server instead of app-server & only run the workflow when a push is made on main branch, PR is closed and merged on main branch --- .github/workflows/CompileTimeDelta.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CompileTimeDelta.yml b/.github/workflows/CompileTimeDelta.yml index 86ccf5d91..99ab7b699 100644 --- a/.github/workflows/CompileTimeDelta.yml +++ b/.github/workflows/CompileTimeDelta.yml @@ -1,6 +1,13 @@ name: Save cargo build timing information -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + types: [closed] + branches: + - main jobs: linux-ubuntu: @@ -9,6 +16,7 @@ jobs: env: CARGO_TERM_COLOR: always + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) steps: - name: Checkout main repo uses: actions/checkout@v4 @@ -16,7 +24,7 @@ jobs: path: debate-map - name: Build Timing working-directory: debate-map - run: cargo build --package app-server --timings + run: cargo build --package app_server --timings - name: Get commit hash working-directory: debate-map