From 25b91359b584558e317fbf5676fde0af64fa1aca Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Tue, 20 Aug 2024 15:43:42 -0400 Subject: [PATCH 1/6] Test partial clone for github workflow --- .github/workflows/deploy_branches.yml | 53 +++++++++++++++------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deploy_branches.yml b/.github/workflows/deploy_branches.yml index cfc7dcecf8..c79e94df58 100644 --- a/.github/workflows/deploy_branches.yml +++ b/.github/workflows/deploy_branches.yml @@ -45,37 +45,42 @@ jobs: opam exec -- dune build @src/fmt --auto-promote src --profile release working-directory: ./source - name: Checkout the website build artifacts repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: hazelgrove/build token: ${{ secrets.ACCESS_TOKEN }} path: server + sparse-checkout: | + ${BRANCH_NAME} - name: Clear any old build of this branch run: if [ -d "${BRANCH_NAME}" ] ; then rm -rf "${BRANCH_NAME}" ; fi working-directory: ./server - name: Copy in the newly built source run: mkdir "./server/${BRANCH_NAME}" && cp -r "./source/_build/default/src/haz3lweb/www"/* "./server/${BRANCH_NAME}" - - name : Commit to the website aka deploy - run: | - git config user.name github-deploy-action - git config user.email hazel-deploy@hazel.org - git add -A - git pull --no-edit - git status - git diff-index --quiet HEAD || (git commit -m "github-deploy-action-${BRANCH_NAME}"; git push) + - name: See the status of the git repo + run: git status working-directory: ./server - - name: Run Tests - id: test - run: | - eval $(opam env) - make test - working-directory: ./source - - name: Test Report - uses: dorny/test-reporter@v1 - with: - name: Test Report - path: junit_tests*.xml - reporter: java-junit - fail-on-error: true - fail-on-empty: true # Use an empty test report to detect when something failed with the test runner - working-directory: ./source \ No newline at end of file + # - name : Commit to the website aka deploy + # run: | + # git config user.name github-deploy-action + # git config user.email hazel-deploy@hazel.org + # git add -A + # git pull --no-edit + # git status + # git diff-index --quiet HEAD || (git commit -m "github-deploy-action-${BRANCH_NAME}"; git push) + # working-directory: ./server + # - name: Run Tests + # id: test + # run: | + # eval $(opam env) + # make test + # working-directory: ./source + # - name: Test Report + # uses: dorny/test-reporter@v1 + # with: + # name: Test Report + # path: junit_tests*.xml + # reporter: java-junit + # fail-on-error: true + # fail-on-empty: true # Use an empty test report to detect when something failed with the test runner + # working-directory: ./source \ No newline at end of file From 1fd5f9810ef8102c5fe71f32c09a9e98601b411a Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Tue, 20 Aug 2024 15:48:57 -0400 Subject: [PATCH 2/6] Actually commit to the build repo --- .github/workflows/deploy_branches.yml | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deploy_branches.yml b/.github/workflows/deploy_branches.yml index c79e94df58..99618f8459 100644 --- a/.github/workflows/deploy_branches.yml +++ b/.github/workflows/deploy_branches.yml @@ -60,27 +60,27 @@ jobs: - name: See the status of the git repo run: git status working-directory: ./server - # - name : Commit to the website aka deploy - # run: | - # git config user.name github-deploy-action - # git config user.email hazel-deploy@hazel.org - # git add -A - # git pull --no-edit - # git status - # git diff-index --quiet HEAD || (git commit -m "github-deploy-action-${BRANCH_NAME}"; git push) - # working-directory: ./server - # - name: Run Tests - # id: test - # run: | - # eval $(opam env) - # make test - # working-directory: ./source - # - name: Test Report - # uses: dorny/test-reporter@v1 - # with: - # name: Test Report - # path: junit_tests*.xml - # reporter: java-junit - # fail-on-error: true - # fail-on-empty: true # Use an empty test report to detect when something failed with the test runner - # working-directory: ./source \ No newline at end of file + - name : Commit to the website aka deploy + run: | + git config user.name github-deploy-action + git config user.email hazel-deploy@hazel.org + git add -A + git pull --no-edit + git status + git diff-index --quiet HEAD || (git commit -m "github-deploy-action-${BRANCH_NAME}"; git push) + working-directory: ./server + - name: Run Tests + id: test + run: | + eval $(opam env) + make test + working-directory: ./source + - name: Test Report + uses: dorny/test-reporter@v1 + with: + name: Test Report + path: junit_tests*.xml + reporter: java-junit + fail-on-error: true + fail-on-empty: true # Use an empty test report to detect when something failed with the test runner + working-directory: ./source \ No newline at end of file From 53e05971c2e6282c6e852bab9db6652df034eacc Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Tue, 20 Aug 2024 15:56:28 -0400 Subject: [PATCH 3/6] Fix branch name in sparse checkout --- .github/workflows/deploy_branches.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_branches.yml b/.github/workflows/deploy_branches.yml index 99618f8459..e4ca7fca0d 100644 --- a/.github/workflows/deploy_branches.yml +++ b/.github/workflows/deploy_branches.yml @@ -51,7 +51,7 @@ jobs: token: ${{ secrets.ACCESS_TOKEN }} path: server sparse-checkout: | - ${BRANCH_NAME} + ${{ env.BRANCH_NAME }} - name: Clear any old build of this branch run: if [ -d "${BRANCH_NAME}" ] ; then rm -rf "${BRANCH_NAME}" ; fi working-directory: ./server From 5d14001d841db0d7fb51e4507f289fa22e5f0b9d Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Tue, 20 Aug 2024 16:01:47 -0400 Subject: [PATCH 4/6] Remove the debug git status --- .github/workflows/deploy_branches.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deploy_branches.yml b/.github/workflows/deploy_branches.yml index e4ca7fca0d..e97dabb62b 100644 --- a/.github/workflows/deploy_branches.yml +++ b/.github/workflows/deploy_branches.yml @@ -57,9 +57,6 @@ jobs: working-directory: ./server - name: Copy in the newly built source run: mkdir "./server/${BRANCH_NAME}" && cp -r "./source/_build/default/src/haz3lweb/www"/* "./server/${BRANCH_NAME}" - - name: See the status of the git repo - run: git status - working-directory: ./server - name : Commit to the website aka deploy run: | git config user.name github-deploy-action From ff1c9962bad574fa550a366774d396ec6696c641 Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Wed, 21 Aug 2024 11:32:01 -0400 Subject: [PATCH 5/6] Run dune fmt before dev and test without failure - dune fmt returns a non-zero exit code if autoformatting promotion happens - So this will run the dune fmt auto-promote and ignore the exit code then run the standard build in dev so you don't have to run make twice - Release is left unchanged since we want the build to fail on invalid formatting --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 82d19880e7..f777d40ded 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,8 @@ setup-instructor: setup-student: cp src/haz3lweb/ExerciseSettings_student.re src/haz3lweb/ExerciseSettings.re -dev-helper: +dev-helper: + dune fmt --auto-promote || true dune build @src/fmt --auto-promote src --profile dev dev: setup-instructor dev-helper @@ -58,6 +59,7 @@ repl: dune utop src/haz3lcore test: + dune fmt --auto-promote || true dune build @src/fmt @test/fmt --auto-promote src test --profile dev node $(TEST_DIR)/haz3ltest.bc.js From 3be2e3e58316f1fcf65807fbef8f65ab5d707ad4 Mon Sep 17 00:00:00 2001 From: Alexander Bandukwala <7h3kk1d@gmail.com> Date: Wed, 21 Aug 2024 11:50:27 -0400 Subject: [PATCH 6/6] Add make watch-test --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f777d40ded..c1f5943d07 100644 --- a/Makefile +++ b/Makefile @@ -63,5 +63,8 @@ test: dune build @src/fmt @test/fmt --auto-promote src test --profile dev node $(TEST_DIR)/haz3ltest.bc.js +watch-test: + dune build @fmt @runtest --auto-promote --watch + clean: dune clean