From 4488d66059ec7dcebb92dfd4b6d354ad5ca61495 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Sat, 9 Mar 2024 10:45:02 +0100 Subject: [PATCH] CI,scripts: DRY around git submodules population --- .github/workflows/CI.yml | 4 ++-- configure.sh | 11 +---------- scripts/bump.fsx | 2 +- scripts/populate_gitsubmodules.sh | 12 ++++++++++++ 4 files changed, 16 insertions(+), 13 deletions(-) create mode 100755 scripts/populate_gitsubmodules.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 033b95c43..ebe5556f2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -514,7 +514,7 @@ jobs: run: ./configure.sh --native-segwit - name: Bump version to beta (because segwit) run: | - git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive + ./scripts/populate_gitsubmodules.sh dotnet fsi ./scripts/beta_bump.fsx - name: pack&push run: make push @@ -585,7 +585,7 @@ jobs: - name: Bump snap version run: | - git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive + ./scripts/populate_gitsubmodules.sh dotnet fsi ./scripts/beta_bump.fsx - name: Generate snap package diff --git a/configure.sh b/configure.sh index 47ae0674a..a252d5b86 100755 --- a/configure.sh +++ b/configure.sh @@ -14,16 +14,7 @@ else cp NuGet-legacy.config NuGet.config - if [ ! -f scripts/fsx/configure.sh ]; then - if ! which git >/dev/null 2>&1; then - echo "checking for git... not found" $'\n' - - echo "$0" $'failed, please install "git" (to populate submodule) first' - exit 1 - fi - echo "Populating sub-fsx module..." - git submodule sync --recursive && git submodule update --init --recursive - fi + ./scripts/populate_gitsubmodules.sh FSX_CHECK_MSG="checking for fsx..." if ! which fsharpi >/dev/null 2>&1; then diff --git a/scripts/bump.fsx b/scripts/bump.fsx index 73159c347..d43c53e1e 100755 --- a/scripts/bump.fsx +++ b/scripts/bump.fsx @@ -260,7 +260,7 @@ let RunUpdateServers () = if not replaceScript.Exists then - Console.Error.WriteLine "Script replace.fsx not found, 'fsx' submodule not populated? Please run `git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive`" + Console.Error.WriteLine "Script replace.fsx not found, 'fsx' submodule not populated? Please run `populate_gitsubmodules.sh`" Environment.Exit 1 GitDiff() diff --git a/scripts/populate_gitsubmodules.sh b/scripts/populate_gitsubmodules.sh new file mode 100755 index 000000000..ca1bc672c --- /dev/null +++ b/scripts/populate_gitsubmodules.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! which git >/dev/null 2>&1; then + echo "checking for git... not found" $'\n' + + echo "$0" $'failed, please install "git" (to populate submodules) first' + exit 1 +fi +echo "Populating git submodules..." + +git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive