From 0de92d9b06a9a6a5094d0baccbee366a71876a24 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Thu, 18 Nov 2021 21:28:52 +0100 Subject: [PATCH 1/2] gha: arrange script files --- .../checker.sh} | 0 .../scripts/{ => common}/hygiene-preamble.sh | 2 +- .github/scripts/common/preamble.sh | 11 +++++ .../scripts/{ => depexts}/generate-actions.sh | 0 .../{hygiene-main.sh => main/hygiene.sh} | 2 +- .github/scripts/{ => main}/legacy.sh | 2 +- .github/scripts/{ => main}/main.sh | 2 +- .github/scripts/{ => main}/ocaml-cache.sh | 2 +- .github/scripts/{ => main}/opam-bs-cache.sh | 2 +- .github/scripts/{ => main}/preamble.sh | 13 +---- .github/scripts/{ => main}/solvers.sh | 2 +- .../hygiene.sh} | 2 +- .github/workflows/changelog_check.yml | 2 +- .github/workflows/depexts.yml | 16 +++---- .github/workflows/main.yml | 48 +++++++++---------- .github/workflows/scripts.yml | 2 +- 16 files changed, 54 insertions(+), 54 deletions(-) rename .github/scripts/{changelog_checker => changelog/checker.sh} (100%) rename .github/scripts/{ => common}/hygiene-preamble.sh (95%) create mode 100644 .github/scripts/common/preamble.sh rename .github/scripts/{ => depexts}/generate-actions.sh (100%) rename .github/scripts/{hygiene-main.sh => main/hygiene.sh} (98%) rename .github/scripts/{ => main}/legacy.sh (92%) rename .github/scripts/{ => main}/main.sh (99%) rename .github/scripts/{ => main}/ocaml-cache.sh (97%) rename .github/scripts/{ => main}/opam-bs-cache.sh (94%) rename .github/scripts/{ => main}/preamble.sh (88%) rename .github/scripts/{ => main}/solvers.sh (94%) rename .github/scripts/{hygiene-scripts.sh => scripts/hygiene.sh} (97%) diff --git a/.github/scripts/changelog_checker b/.github/scripts/changelog/checker.sh similarity index 100% rename from .github/scripts/changelog_checker rename to .github/scripts/changelog/checker.sh diff --git a/.github/scripts/hygiene-preamble.sh b/.github/scripts/common/hygiene-preamble.sh similarity index 95% rename from .github/scripts/hygiene-preamble.sh rename to .github/scripts/common/hygiene-preamble.sh index 2285e14a74a..63dc514629b 100644 --- a/.github/scripts/hygiene-preamble.sh +++ b/.github/scripts/common/hygiene-preamble.sh @@ -1,4 +1,4 @@ -#!/bin/bash -xue +. .github/scripts/common/preamble.sh if [ "$GITHUB_EVENT_NAME" = "pull_request" ] && [ "x" = "x$BASE_REF_SHA$PR_REF_SHA" ] ; then echo "Variables BASE_REF_SHA and PR_REF_SHA must be defined in a pull request job" diff --git a/.github/scripts/common/preamble.sh b/.github/scripts/common/preamble.sh new file mode 100644 index 00000000000..f7080f30e6d --- /dev/null +++ b/.github/scripts/common/preamble.sh @@ -0,0 +1,11 @@ +case $GITHUB_EVENT_NAME in + pull_request) + BRANCH=$GITHUB_HEAD_REF + ;; + push) + BRANCH=${GITHUB_REF##*/} + ;; + *) + echo -e "Not handled event" + BRANCH=master +esac diff --git a/.github/scripts/generate-actions.sh b/.github/scripts/depexts/generate-actions.sh similarity index 100% rename from .github/scripts/generate-actions.sh rename to .github/scripts/depexts/generate-actions.sh diff --git a/.github/scripts/hygiene-main.sh b/.github/scripts/main/hygiene.sh similarity index 98% rename from .github/scripts/hygiene-main.sh rename to .github/scripts/main/hygiene.sh index 6a79cd87790..9840574cb8a 100644 --- a/.github/scripts/hygiene-main.sh +++ b/.github/scripts/main/hygiene.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/hygiene-preamble.sh +. .github/scripts/common/hygiene-preamble.sh CheckConfigure () { GIT_INDEX_FILE=tmp-index git read-tree --reset -i "$1" diff --git a/.github/scripts/legacy.sh b/.github/scripts/main/legacy.sh similarity index 92% rename from .github/scripts/legacy.sh rename to .github/scripts/main/legacy.sh index d7c52806026..6c4515d04eb 100644 --- a/.github/scripts/legacy.sh +++ b/.github/scripts/main/legacy.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/preamble.sh +. .github/scripts/main/preamble.sh export OPAMYES=1 export OCAMLRUNPARAM=b diff --git a/.github/scripts/main.sh b/.github/scripts/main/main.sh similarity index 99% rename from .github/scripts/main.sh rename to .github/scripts/main/main.sh index 52c8492bcf7..f9d38fd094e 100644 --- a/.github/scripts/main.sh +++ b/.github/scripts/main/main.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/preamble.sh +. .github/scripts/main/preamble.sh unset-dev-version () { # disable git versioning to allow OPAMYES use for upgrade diff --git a/.github/scripts/ocaml-cache.sh b/.github/scripts/main/ocaml-cache.sh similarity index 97% rename from .github/scripts/ocaml-cache.sh rename to .github/scripts/main/ocaml-cache.sh index a841b00534c..9400d9d042a 100644 --- a/.github/scripts/ocaml-cache.sh +++ b/.github/scripts/main/ocaml-cache.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/preamble.sh +. .github/scripts/main/preamble.sh wget "https://caml.inria.fr/pub/distrib/ocaml-${OCAML_VERSION%.*}/ocaml-$OCAML_VERSION.tar.gz" tar -xzf "ocaml-$OCAML_VERSION.tar.gz" diff --git a/.github/scripts/opam-bs-cache.sh b/.github/scripts/main/opam-bs-cache.sh similarity index 94% rename from .github/scripts/opam-bs-cache.sh rename to .github/scripts/main/opam-bs-cache.sh index ac37bfc8a06..f79f289c0f3 100644 --- a/.github/scripts/opam-bs-cache.sh +++ b/.github/scripts/main/opam-bs-cache.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/preamble.sh +. .github/scripts/main/preamble.sh rm -f $OPAM_LOCAL/bin/opam-bootstrap mkdir -p $OPAM_LOCAL/bin/ diff --git a/.github/scripts/preamble.sh b/.github/scripts/main/preamble.sh similarity index 88% rename from .github/scripts/preamble.sh rename to .github/scripts/main/preamble.sh index 1342a78821e..1291866dc53 100644 --- a/.github/scripts/preamble.sh +++ b/.github/scripts/main/preamble.sh @@ -1,3 +1,4 @@ +. .github/scripts/common/preamble.sh CWD=$PWD CACHE=~/.cache @@ -18,18 +19,6 @@ OPAMBSSWITCH=opam-build export OPAMCONFIRMLEVEL=unsafe-yes -case $GITHUB_EVENT_NAME in - pull_request) - BRANCH=$GITHUB_HEAD_REF - ;; - push) - BRANCH=${GITHUB_REF##*/} - ;; - *) - echo -e "Not handled event" - BRANCH=master -esac - git config --global user.email "gha@example.com" git config --global user.name "Github Actions CI" git config --global gc.autoDetach false diff --git a/.github/scripts/solvers.sh b/.github/scripts/main/solvers.sh similarity index 94% rename from .github/scripts/solvers.sh rename to .github/scripts/main/solvers.sh index 22e790d6737..18d7f9665ba 100644 --- a/.github/scripts/solvers.sh +++ b/.github/scripts/main/solvers.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/preamble.sh +. .github/scripts/main/preamble.sh export OCAMLRUNPARAM=b diff --git a/.github/scripts/hygiene-scripts.sh b/.github/scripts/scripts/hygiene.sh similarity index 97% rename from .github/scripts/hygiene-scripts.sh rename to .github/scripts/scripts/hygiene.sh index 5f50be2a6e1..173e946bf8d 100644 --- a/.github/scripts/hygiene-scripts.sh +++ b/.github/scripts/scripts/hygiene.sh @@ -1,6 +1,6 @@ #!/bin/bash -xue -. .github/scripts/hygiene-preamble.sh +. .github/scripts/common/hygiene-preamble.sh ### # Check install.sh diff --git a/.github/workflows/changelog_check.yml b/.github/workflows/changelog_check.yml index 82df457dccd..d507209062a 100644 --- a/.github/workflows/changelog_check.yml +++ b/.github/workflows/changelog_check.yml @@ -9,4 +9,4 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - run: bash .github/scripts/changelog_checker + - run: bash .github/scripts/changelog/checker.sh diff --git a/.github/workflows/depexts.yml b/.github/workflows/depexts.yml index 4251b8d243a..e6402089b2b 100644 --- a/.github/workflows/depexts.yml +++ b/.github/workflows/depexts.yml @@ -44,7 +44,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh alpine + bash .github/scripts/depexts/generate-actions.sh alpine - name: depexts actions alpine uses: ./.github/actions/alpine id: depexts-alpine @@ -62,7 +62,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh archlinux + bash .github/scripts/depexts/generate-actions.sh archlinux - name: depexts actions archlinux uses: ./.github/actions/archlinux id: depexts-archlinux @@ -80,7 +80,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh centos + bash .github/scripts/depexts/generate-actions.sh centos - name: depexts actions centos uses: ./.github/actions/centos id: depexts-centos @@ -98,7 +98,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh debian + bash .github/scripts/depexts/generate-actions.sh debian - name: depexts actions debian uses: ./.github/actions/debian id: depexts-debian @@ -116,7 +116,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh fedora + bash .github/scripts/depexts/generate-actions.sh fedora - name: depexts actions fedora uses: ./.github/actions/fedora id: depexts-fedora @@ -134,7 +134,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh opensuse + bash .github/scripts/depexts/generate-actions.sh opensuse - name: depexts actions opensuse uses: ./.github/actions/opensuse id: depexts-opensuse @@ -152,7 +152,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh oraclelinux + bash .github/scripts/depexts/generate-actions.sh oraclelinux - name: depexts actions oraclelinux uses: ./.github/actions/oraclelinux id: depexts-oraclelinux @@ -170,7 +170,7 @@ jobs: key: binary-${{ env.OPAMVERSION }} - name: generate action run: | - bash .github/scripts/generate-actions.sh ubuntu + bash .github/scripts/depexts/generate-actions.sh ubuntu - name: depexts actions ubuntu uses: ./.github/actions/ubuntu id: depexts-ubuntu diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cdb71e0a305..24dd3219a77 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -74,12 +74,12 @@ jobs: # uses: actions/cache@v2 # with: # path: ${{ env.GH_OCAML_CACHE }} -# key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }} +# key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} # - name: Building ocaml ${{ matrix.ocamlv }} cache # if: steps.ocaml-cache.outputs.cache-hit != 'true' # env: # OCAML_VERSION: ${{ matrix.ocamlv }} -# run: bash -exu .github/scripts/ocaml-cache.sh ocaml +# run: bash -exu .github/scripts/main/ocaml-cache.sh ocaml archives-cache: runs-on: ubuntu-latest @@ -93,7 +93,7 @@ jobs: key: archives-${{ hashFiles('src_ext/Makefile.sources', 'src_ext/Makefile') }} - name: Retrieve archives if: steps.archives.outputs.cache-hit != 'true' - run: |#bash -exu .github/scripts/caches.sh archives + run: |#bash -exu .github/scripts/main/caches.sh archives rm -rf src_ext/archives export PATH=~/.cache/ocaml-local/bin:$PATH which ocaml && export OCAML=`which ocaml` || true @@ -126,16 +126,16 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.GH_OCAML_CACHE }} - key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }} + key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} - name: Building ocaml ${{ matrix.ocamlv }} cache if: steps.ocaml-cache.outputs.cache-hit != 'true' env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/ocaml-cache.sh ocaml + run: bash -exu .github/scripts/main/ocaml-cache.sh ocaml - name: Build env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/main.sh + run: bash -exu .github/scripts/main/main.sh #### # Legacy @@ -160,16 +160,16 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.GH_OCAML_CACHE }} - key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }} + key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} - name: Building ocaml ${{ matrix.ocamlv }} cache if: steps.ocaml-cache.outputs.cache-hit != 'true' env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/ocaml-cache.sh ocaml + run: bash -exu .github/scripts/main/ocaml-cache.sh ocaml - name: Build env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/legacy.sh + run: bash -exu .github/scripts/main/legacy.sh #### # Opam tests @@ -194,12 +194,12 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.GH_OCAML_CACHE }} - key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }}-test + key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }}-test - name: Building ocaml ${{ env.OCAML_VERSION }} cache - test if: steps.ocaml-cache-test.outputs.cache-hit != 'true' env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/ocaml-cache.sh ocaml + run: bash -exu .github/scripts/main/ocaml-cache.sh ocaml - name: opam bootstrap cache id: opam-bootstrap uses: actions/cache@v2 @@ -207,10 +207,10 @@ jobs: path: | ${{ env.OPAMBSROOT }}/** ~/.cache/opam-local/bin/** - key: opam-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ hashFiles ('.github/scripts/opam-bs-cache.sh', '.github/scripts/preamble.sh') }} + key: opam-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ hashFiles ('.github/scripts/main/opam-bs-cache.sh', '.github/scripts/main/preamble.sh') }} - name: opam root cache if: steps.opam-bootstrap.outputs.cache-hit != 'true' - run: bash -exu .github/scripts/opam-bs-cache.sh + run: bash -exu .github/scripts/main/opam-bs-cache.sh - name: opam-rt cache id: opam-rt uses: actions/cache@v2 @@ -220,7 +220,7 @@ jobs: - name: Test env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/main.sh + run: bash -exu .github/scripts/main/main.sh #### # Opam cold @@ -251,7 +251,7 @@ jobs: run: | make compiler make lib-pkg - bash -exu .github/scripts/main.sh + bash -exu .github/scripts/main/main.sh #### # Compile solver backends @@ -278,12 +278,12 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.GH_OCAML_CACHE }} - key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ matrix.solver }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }}-test + key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ matrix.solver }}-${{ hashFiles ('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }}-test - name: Building ocaml ${{ env.OCAML_VERSION }} cache - test if: steps.ocaml-cache-test.outputs.cache-hit != 'true' env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/ocaml-cache.sh ocaml + run: bash -exu .github/scripts/main/ocaml-cache.sh ocaml - name: opam bootstrap cache id: opam-bootstrap uses: actions/cache@v2 @@ -291,16 +291,16 @@ jobs: path: | ~/.cache/opam.${{ matrix.solver }}.cached ~/.cache/opam-local/bin/** - key: opam-${{ matrix.solver }}-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ hashFiles ('.github/scripts/opam-bs-cache.sh', '.github/scripts/preamble.sh') }} + key: opam-${{ matrix.solver }}-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ hashFiles ('.github/scripts/main/opam-bs-cache.sh', '.github/scripts/main/preamble.sh') }} - name: opam root cache env: OPAMBSROOT: ~/.cache/opam.${{ matrix.solver }}.cached if: steps.opam-bootstrap.outputs.cache-hit != 'true' - run: bash -exu .github/scripts/opam-bs-cache.sh + run: bash -exu .github/scripts/main/opam-bs-cache.sh - name: Compile env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/solvers.sh + run: bash -exu .github/scripts/main/solvers.sh #### # Upgrade from 1.2 to current @@ -328,17 +328,17 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.GH_OCAML_CACHE }} - key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }} + key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} - name: Building ocaml ${{ matrix.ocamlv }} cache if: steps.ocaml-cache.outputs.cache-hit != 'true' env: OCAML_VERSION: ${{ matrix.ocamlv }} - run: bash -exu .github/scripts/ocaml-cache.sh ocaml + run: bash -exu .github/scripts/main/ocaml-cache.sh ocaml - name: Upgrade env: OCAML_VERSION: ${{ matrix.ocamlv }} OPAM_UPGRADE: 1 - run: bash -exu .github/scripts/main.sh + run: bash -exu .github/scripts/main/main.sh #### # Around opam tests @@ -377,4 +377,4 @@ jobs: # Defined only on pull request jobs BASE_REF_SHA: ${{ github.event.pull_request.base.sha }} PR_REF_SHA: ${{ github.event.pull_request.head.sha }} - run: bash -exu .github/scripts/hygiene-main.sh + run: bash -exu .github/scripts/main/hygiene.sh diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml index ec74010fccc..7c1f6496279 100644 --- a/.github/workflows/scripts.yml +++ b/.github/workflows/scripts.yml @@ -19,4 +19,4 @@ jobs: # Defined only on pull request jobs BASE_REF_SHA: ${{ github.event.pull_request.base.sha }} PR_REF_SHA: ${{ github.event.pull_request.head.sha }} - run: bash -exu .github/scripts/hygiene-scripts.sh + run: bash -exu .github/scripts/scripts/hygiene.sh From 2517c63fe53c3bf6a0268bcd3a50fb33d9030097 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 19 Nov 2021 12:51:13 +0100 Subject: [PATCH 2/2] update changes --- master_changes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/master_changes.md b/master_changes.md index 4209a4dae25..d49e3e50925 100644 --- a/master_changes.md +++ b/master_changes.md @@ -164,6 +164,7 @@ users) * Add opam.ocaml.org cache to reach disappearing archive [#4865 @rjbou] * Update ocaml version frm 4.11.2 to 4.12.0 (because of macos failure) [#4865 @rjbou] * Add a depext checkup, launched only is `OpamSysInteract` is changed [#4788 @rjbou] + * Arrange scripts directory [#4922 @rjbou] ## Shell * fish: fix deprecated redirection syntax `^` [#4736 @vzaliva]