diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-07-25 15:36:23 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-23 16:00:17 -0400 |
commit | 55112fbfe6d1fad61b27780d3361a330359d48b3 (patch) | |
tree | e7f6b1b04390d4c58b54691a50397c9cc4bcaf2e | |
parent | cbfc0e933660626c9f4eaf5480076b6fcd31dceb (diff) | |
download | haskell-55112fbfe6d1fad61b27780d3361a330359d48b3.tar.gz |
ci: Move phase timing logic into ci.sh
-rw-r--r-- | .gitlab-ci.yml | 120 | ||||
-rwxr-xr-x | .gitlab/ci.sh | 14 |
2 files changed, 33 insertions, 101 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 246b8c94fa..5b7a21b183 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -304,6 +304,7 @@ lint-release-changelogs: after_script: - .gitlab/ci.sh save_cache - .gitlab/ci.sh clean + - cat ci-timings tags: - x86_64-linux @@ -377,6 +378,7 @@ hadrian-ghc-in-ghci: - echo ":q" | hadrian/ghci -j`mk/detect-cpu-count.sh`| tail -n2 | grep "Ok," after_script: - .gitlab/ci.sh save_cache + - cat ci-timings cache: key: hadrian-ghci paths: @@ -402,6 +404,7 @@ hadrian-ghc-in-ghci: - .gitlab/ci.sh setup after_script: - .gitlab/ci.sh save_cache + - cat ci-timings variables: GHC_FLAGS: -Werror cache: @@ -432,36 +435,10 @@ lint-libs: if [[ "$RELEASE_JOB" = "yes" ]]; then HADDOCK_HYPERLINKED_SOURCES=1 fi - TIME_START=$(date +%s) - time .gitlab/ci.sh setup 2>&1 - TIME_SETUP=$(date +%s) - TIME_SETUP_DELTA=$(expr $TIME_SETUP - $TIME_START) - echo "Setup took $TIME_SETUP_DELTA seconds" - - time .gitlab/ci.sh configure 2>&1 - TIME_CONFIGURE=$(date +%s) - TIME_CONFIGURE_DELTA=$(expr $TIME_CONFIGURE - $TIME_SETUP) - echo "Configure took $TIME_CONFIGURE_DELTA seconds" - - time .gitlab/ci.sh build_make 2>&1 - TIME_BUILD=$(date +%s) - TIME_BUILD_DELTA=$(expr $TIME_BUILD - $TIME_CONFIGURE) - echo "Build took $TIME_BUILD_DELTA seconds" - - set +e - time .gitlab/ci.sh test_make 2>&1 - status=$? - set -e - TIME_TEST=$(date +%s) - TIME_TEST_DELTA=$(expr $TIME_TEST - $TIME_BUILD) - echo "Test took $TIME_TEST_DELTA seconds" - - echo "=== TIMINGS ===" - echo "Setup | $TIME_SETUP_DELTA" - echo "Configure | $TIME_CONFIGURE_DELTA" - echo "Build | $TIME_BUILD_DELTA" - echo "Test | $TIME_TEST_DELTA" - exit $status + .gitlab/ci.sh setup + .gitlab/ci.sh configure + .gitlab/ci.sh build_make + .gitlab/ci.sh test_make dependencies: [] artifacts: @@ -497,6 +474,7 @@ lint-libs: after_script: - .gitlab/ci.sh save_cache - .gitlab/ci.sh clean + - cat ci-timings artifacts: when: always expire_in: 2 week @@ -536,6 +514,7 @@ release-x86_64-freebsd: after_script: - .gitlab/ci.sh save_cache - .gitlab/ci.sh clean + - cat ci-timings artifacts: when: always expire_in: 2 week @@ -589,6 +568,7 @@ validate-x86_64-darwin: IGNORE_PERF_FAILURES: "all" after_script: - .gitlab/ci.sh clean + - cat ci-timings # I wish we could just use the nix #! logic, but we can't --run and -i bash # behave very differently. -i bash does not pass any nix related env vars @@ -614,47 +594,20 @@ validate-x86_64-darwin: # fix up config.sub in libraries for the time. # aarch64-darwin is not supported in older config.sub's - TIME_START=$(date +%s) find libraries -name config.sub -exec cp config.sub {} \; - runInNixShell ".gitlab/ci.sh setup" 2>&1 - TIME_SETUP=$(date +%s) - TIME_SETUP_DELTA=$(expr $TIME_SETUP - $TIME_START) - echo "Setup took $TIME_SETUP_DELTA seconds" + runInNixShell ".gitlab/ci.sh setup" # make sure $HOME is prisine echo "Deleting $HOME/.cabal" rm -fR $HOME/.cabal - runInNixShell "cabal update --index=$HACKAGE_INDEX_STATE" 2>&1 - - runInNixShell ".gitlab/ci.sh configure" 2>&1 - TIME_CONFIGURE=$(date +%s) - TIME_CONFIGURE_DELTA=$(expr $TIME_CONFIGURE - $TIME_SETUP) - echo "Configure took $TIME_CONFIGURE_DELTA seconds" - - runInNixShell ".gitlab/ci.sh build_hadrian" 2>&1 - TIME_BUILD=$(date +%s) - TIME_BUILD_DELTA=$(expr $TIME_BUILD - $TIME_CONFIGURE) - echo "Build took $TIME_BUILD_DELTA seconds" - - set +e - runInNixShell ".gitlab/ci.sh test_hadrian" 2>&1 - status=$? - set -e - - TIME_TEST=$(date +%s) - TIME_TEST_DELTA=$(expr $TIME_TEST - $TIME_BUILD) - echo "Test took $TIME_TEST_DELTA seconds" + runInNixShell "cabal update --index=$HACKAGE_INDEX_STATE" + runInNixShell ".gitlab/ci.sh configure" + runInNixShell ".gitlab/ci.sh build_hadrian" + runInNixShell ".gitlab/ci.sh test_hadrian" # Important to run this in nix-shell because $HOME is different in there - runInNixShell ".gitlab/ci.sh save_cache" 2>&1 - - echo "=== TIMINGS ===" - echo "Setup | $TIME_SETUP_DELTA" - echo "Configure | $TIME_CONFIGURE_DELTA" - echo "Build | $TIME_BUILD_DELTA" - echo "Test | $TIME_TEST_DELTA" - exit $status + runInNixShell ".gitlab/ci.sh save_cache" artifacts: when: always @@ -687,6 +640,7 @@ validate-aarch64-darwin: TEST_ENV: "aarch64-darwin-hadrian" after_script: - .gitlab/ci.sh clean + - cat ci-timings # I wish we could just use the nix #! logic, but we can't --run and -i bash # behave very differently. -i bash does not pass any nix related env vars @@ -711,46 +665,20 @@ validate-aarch64-darwin: # fix up config.sub in libraries for the time. # aarch64-darwin is not supported in older config.sub's - TIME_START=$(date +%s) find libraries -name config.sub -exec cp config.sub {} \; - time runInNixShell ".gitlab/ci.sh setup" 2>&1 - TIME_SETUP=$(date +%s) - TIME_SETUP_DELTA=$(expr $TIME_SETUP - $TIME_START) - echo "Setup took $TIME_SETUP_DELTA seconds" + runInNixShell ".gitlab/ci.sh setup" # make sure $HOME is prisine echo "Deleting $HOME/.cabal" rm -fR $HOME/.cabal - runInNixShell "cabal update --index=$HACKAGE_INDEX_STATE" 2>&1 - - runInNixShell ".gitlab/ci.sh configure" 2>&1 - TIME_CONFIGURE=$(date +%s) - TIME_CONFIGURE_DELTA=$(expr $TIME_CONFIGURE - $TIME_SETUP) - echo "Setup took $TIME_CONFIGURE_DELTA seconds" - - runInNixShell ".gitlab/ci.sh build_hadrian" 2>&1 - TIME_BUILD=$(date +%s) - TIME_BUILD_DELTA=$(expr $TIME_BUILD - $TIME_CONFIGURE) - echo "Build took $TIME_BUILD_DELTA seconds" - - set +e - runInNixShell ".gitlab/ci.sh test_hadrian" 2>&1 - status=$? - set -e - TIME_TEST=$(date +%s) - TIME_TEST_DELTA=$(expr $TIME_TEST - $TIME_BUILD) - echo "Test took $TIME_TEST_DELTA seconds" + runInNixShell "cabal update --index=$HACKAGE_INDEX_STATE" + runInNixShell ".gitlab/ci.sh configure" + runInNixShell ".gitlab/ci.sh build_hadrian" + runInNixShell ".gitlab/ci.sh test_hadrian" # Important to run this in nix-shell because $HOME is different there - runInNixShell ".gitlab/ci.sh save_cache" 2>&1 - - echo "=== TIMINGS ===" - echo "Setup | $TIME_SETUP_DELTA" - echo "Configure | $TIME_CONFIGURE_DELTA" - echo "Build | $TIME_BUILD_DELTA" - echo "Test | $TIME_TEST_DELTA" - exit $status + runInNixShell ".gitlab/ci.sh save_cache" artifacts: when: always @@ -769,6 +697,7 @@ validate-aarch64-darwin: - sudo chown ghc:ghc -R . after_script: - cp -Rf $HOME/.cabal cabal-cache + - cat ci-timings cache: key: linux paths: @@ -1205,6 +1134,7 @@ release-x86_64-linux-fedora27-dwarf: after_script: - bash .gitlab/ci.sh save_cache - bash .gitlab/ci.sh clean + - type ci-timings dependencies: [] variables: #FORCE_SYMLINKS: 1 diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index f6e6dddcf7..85fd59cd59 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -214,6 +214,8 @@ function set_toolchain_paths() { # Extract GHC toolchain function setup() { + echo "=== TIMINGS ===" > ci-timings + if [ -d "$CABAL_CACHE" ]; then info "Extracting cabal cache from $CABAL_CACHE to $CABAL_DIR..." mkdir -p "$CABAL_DIR" @@ -221,7 +223,7 @@ function setup() { fi if [[ "$needs_toolchain" = "1" ]]; then - setup_toolchain + time_it "setup" setup_toolchain fi cabal update --index="$HACKAGE_INDEX_STATE" @@ -610,22 +612,22 @@ set_toolchain_paths case $1 in usage) usage ;; setup) setup && cleanup_submodules ;; - configure) configure ;; - build_make) build_make ;; + configure) time_it "configure" configure ;; + build_make) time_it "build" build_make ;; test_make) fetch_perf_notes res=0 - test_make || res=$? + time_it "test" test_make || res=$? push_perf_notes exit $res ;; - build_hadrian) build_hadrian ;; + build_hadrian) time_it "build" build_hadrian ;; # N.B. Always push notes, even if the build fails. This is okay to do as the # testsuite driver doesn't record notes for tests that fail due to # correctness. test_hadrian) fetch_perf_notes res=0 - test_hadrian || res=$? + time_it "test" test_hadrian || res=$? push_perf_notes exit $res ;; run_hadrian) shift; run_hadrian "$@" ;; |