Skip to content

Commit

Permalink
Merge pull request #4922 from rjbou/gha
Browse files Browse the repository at this point in the history
GHA: arrange script files/directory
  • Loading branch information
rjbou authored Nov 22, 2021
2 parents c7759e0 + 2517c63 commit 0a247e1
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 54 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
11 changes: 11 additions & 0 deletions .github/scripts/common/preamble.sh
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -xue

. .github/scripts/preamble.sh
. .github/scripts/main/preamble.sh

export OPAMYES=1
export OCAMLRUNPARAM=b
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/main.sh → .github/scripts/main/main.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
13 changes: 1 addition & 12 deletions .github/scripts/preamble.sh → .github/scripts/main/preamble.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
. .github/scripts/common/preamble.sh

CWD=$PWD
CACHE=~/.cache
Expand All @@ -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 "[email protected]"
git config --global user.name "Github Actions CI"
git config --global gc.autoDetach false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -xue

. .github/scripts/preamble.sh
. .github/scripts/main/preamble.sh

export OCAMLRUNPARAM=b

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -xue

. .github/scripts/hygiene-preamble.sh
. .github/scripts/common/hygiene-preamble.sh

###
# Check install.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions .github/workflows/depexts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
48 changes: 24 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -194,23 +194,23 @@ 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
with:
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -278,29 +278,29 @@ 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
with:
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,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]
Expand Down

0 comments on commit 0a247e1

Please sign in to comment.