Skip to content

Commit 80cc710

Browse files
feat: Add diracx repo choice in the integration test
1 parent 7859c6b commit 80cc710

File tree

4 files changed

+40
-11
lines changed

4 files changed

+40
-11
lines changed

.github/workflows/integration.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Integration tests
22

3+
env:
4+
DIRACX_REPO: default
5+
DIRACX_BRANCH: main
6+
37
on:
48
push:
59
paths-ignore:
@@ -37,7 +41,7 @@ jobs:
3741
ARGS: DIRAC_USE_JSON_ENCODE=NO MYSQL_VER=mysql:8.0.40
3842
- TEST_NAME: "Backward Compatibility"
3943
ARGS: CLIENT_INSTALLATION_BRANCH=rel-v8r0 PILOT_INSTALLATION_BRANCH=rel-v8r0
40-
- TEST_NAME: "NoTestDIRACX"
44+
- TEST_NAME: "TestDIRACX"
4145
ARGS: TEST_DIRACX=Yes
4246

4347
steps:
@@ -58,8 +62,19 @@ jobs:
5862
pyyaml \
5963
requests \
6064
typer
65+
- name: Set DIRACX args
66+
if: ${{ contains(matrix.ARGS, 'TEST_DIRACX=Yes') }}
67+
run: |
68+
if [ "${DIRACX_REPO}" != "default" ]; then
69+
echo "DIRACX_REPO=${DIRACX_REPO}" >> $GITHUB_ENV
70+
echo "DIRACX_BRANCH=${DIRACX_BRANCH}" >> $GITHUB_ENV
71+
else
72+
echo "DIRACX_ARGS=" >> $GITHUB_ENV
73+
fi
74+
6175
- name: Prepare environment
62-
run: ./integration_tests.py prepare-environment ${{ matrix.ARGS }}
76+
run: |
77+
./integration_tests.py prepare-environment ${{ matrix.ARGS }} ${DIRACX_ARGS}
6378
- name: Install server
6479
run: ./integration_tests.py install-server
6580
- name: Install client

integration_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"DIRAC_USE_JSON_ENCODE": None,
3636
"INSTALLATION_BRANCH": "",
3737
"DEBUG": "Yes",
38+
"DIRACX_REPO": "",
39+
"DIRACX_BRANCH": "",
3840
}
3941
DIRACX_OPTIONS = ()
4042
DEFAULT_MODULES = {"DIRAC": Path(__file__).parent.absolute()}

tests/CI/install_client.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ if ! source "${DIRAC_CI_SETUP_SCRIPT}"; then
5858
fi
5959

6060
if [[ -n "${INSTALLATION_BRANCH}" ]]; then
61-
# shellcheck disable=SC2034
62-
DIRACSETUP=$(< "${INSTALL_CFG_FILE}" grep "Setup = " | cut -f5 -d " ")
61+
# shellcheck disable=SC2034
62+
DIRACSETUP=$(< "${INSTALL_CFG_FILE}" grep "Setup = " | cut -f5 -d " ")
6363
fi
6464

6565
echo -e "*** $(date -u) **** Client INSTALLATION START ****\n"

tests/Jenkins/utilities.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,33 @@ installDIRAC() {
293293
# Arguments: list of DiracX submodule module names to install (core, client, etc.)
294294

295295
function installDIRACX() {
296-
# Get the latest tag from GitHub
297-
latest_tag=$(git ls-remote --tags https://github.com/DIRACGrid/diracx.git | awk -F/ '{print $NF}' | grep -v '{}' | sort -V | tail -n1)
296+
# Determine repo and ref to install from
297+
local repo="${DIRACX_REPO:-https://github.com/DIRACGrid/diracx.git}"
298+
local ref
298299

299-
echo "Installing from tag: $latest_tag"
300+
if [[ -n "${DIRACX_BRANCH:-}" ]]; then
301+
ref="$DIRACX_BRANCH"
302+
echo "Installing from branch: $ref"
303+
else
304+
# fetch latest tag from main repo
305+
ref=$(git ls-remote --tags "$repo" \
306+
| awk -F/ '{print $NF}' \
307+
| grep -v '{}' \
308+
| sort -V \
309+
| tail -n1)
310+
echo "Installing from tag: $ref"
311+
fi
300312

301313
for wheel_name in "$@"; do
302314
if [[ -n "${DIRACX_CUSTOM_SOURCE_PREFIXES:-}" ]]; then
303315
wheels=( $(find "${DIRACX_CUSTOM_SOURCE_PREFIXES}" -name "diracx_${wheel_name}-*.whl") )
304-
if [[ ! ${#wheels[@]} -eq 1 ]]; then
305-
echo "ERROR: Multiple or no wheels found for ${wheel_name} in ${DIRACX_CUSTOM_SOURCE_PREFIXES}"
306-
exit 1
316+
if [[ ${#wheels[@]} -ne 1 ]]; then
317+
echo "ERROR: Multiple or no wheels found for ${wheel_name}"
318+
exit 1
307319
fi
308320
pip install "${wheels[0]}"
309321
else
310-
pip install "git+https://github.com/DIRACGrid/diracx.git@${latest_tag}#egg=diracx-${wheel_name}&subdirectory=diracx-${wheel_name}"
322+
pip install "git+${repo}@${ref}#egg=diracx-${wheel_name}&subdirectory=diracx-${wheel_name}"
311323
fi
312324
done
313325
}

0 commit comments

Comments
 (0)