mirror of https://github.com/CGAL/cgal
# Ceci est la combinaison de 7 commits.
# Ceci est le premier message de validation : First step of action # Ceci est le message de validation numéro 2 : add ssh stuff # Ceci est le message de validation numéro 3 : Update github action # Ceci est le message de validation numéro 4 : Fix Logic # Ceci est le message de validation numéro 5 : Don't override the PATH !!! # Ceci est le message de validation numéro 6 : Download the known host too, so it is possible to add new IPs in it. # Ceci est le message de validation numéro 7 : Fix GIT path and better management of VERSION_NUMBER
This commit is contained in:
parent
500f8dad40
commit
026907a9ce
|
|
@ -0,0 +1,99 @@
|
|||
name: Filter Testsuite
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
id: check
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const userName = context.payload.comment.user.login
|
||||
if(userName == 'maxGimeno') {
|
||||
const body = context.payload.comment.body
|
||||
if(body.includes("/testme")) {
|
||||
return 'OK'
|
||||
}
|
||||
}
|
||||
return 'stop'
|
||||
- uses: actions/github-script@v3
|
||||
if: steps.check.result != 'stop'
|
||||
id: get_label
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
//get branch name and username
|
||||
const pr_url = context.payload.issue.pull_request.url
|
||||
const pr_content = await github.request(pr_url)
|
||||
const label = pr_content.data.head.label
|
||||
console.log(label)
|
||||
return label
|
||||
- uses: actions/github-script@v3
|
||||
if: steps.check.result != 'stop'
|
||||
id: get_base
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
//get branch name and username
|
||||
const pr_url = context.payload.issue.pull_request.url
|
||||
const pr_content = await github.request(pr_url)
|
||||
const base = pr_content.data.base.ref
|
||||
console.log(base)
|
||||
return base
|
||||
- name: Run Testsuite
|
||||
if: steps.check.outputs.result != 'stop'
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
#ssh key
|
||||
(
|
||||
cat <<EOF
|
||||
${{ secrets.ssh_key }}
|
||||
EOF
|
||||
)>> ~/.ssh/id_rsa
|
||||
chmod 600 /home/runner/.ssh/id_rsa
|
||||
#ssh public key
|
||||
(
|
||||
cat <<EOF
|
||||
${{ secrets.ssh_key_pub }}
|
||||
EOF
|
||||
)>> ~/.ssh/id_rsa.pub
|
||||
chmod 644 /home/runner/.ssh/id_rsa.pub
|
||||
#known hosts
|
||||
wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_known_hosts -O ~/.ssh/known_hosts
|
||||
#config file
|
||||
wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_config -O ~/.ssh/config
|
||||
#list of hosts
|
||||
wget --no-check-certificate https://cgal.geometryfactory.com/CGAL/ssh_host_list -O ~/ssh_host_list
|
||||
#ssh command
|
||||
LABEL="${{ steps.get_label.outputs.result }}"
|
||||
USER_NAME=$(echo $LABEL | cut -d':' -f 1)
|
||||
BRANCH_NAME=$(echo $LABEL | cut -d':' -f 2)
|
||||
BASE="${{ steps.get_base.outputs.result }}"
|
||||
mapfile -t HOSTS < ~/ssh_host_list;
|
||||
LAST_INDEX=$((${#HOSTS[@]}-1))
|
||||
for i in ${!HOSTS[@]}; do
|
||||
HOST=$(echo ${HOSTS[$i]}|cut -d' ' -f 1 )
|
||||
PATH_TO_SCRIPT=$(echo ${HOSTS[$i]}|cut -d' ' -f 2 )
|
||||
if [ "$i" -ne "$LAST_INDEX" ] ; then
|
||||
ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE"
|
||||
else
|
||||
ssh ${HOST} "${PATH_TO_SCRIPT}/run_testsuite_from_branch_name.sh $USER_NAME $BRANCH_NAME $BASE y"
|
||||
fi
|
||||
done
|
||||
- name: Post address
|
||||
uses: actions/github-script@v3
|
||||
if: steps.check.outputs.result != 'stop'
|
||||
with:
|
||||
script: |
|
||||
const address = "The testsuite is lauched. results will be found, after it is done, here : https://cgal.geometryfactory.com/~mgimeno/test_suite/TESTRESULTS/index.shtml "
|
||||
github.issues.createComment({
|
||||
owner: "maxGimeno",
|
||||
repo: "cgal",
|
||||
issue_number: ${{ github.event.issue.number }},
|
||||
body: address
|
||||
});
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
|
||||
#To run: $1 = name of the user
|
||||
# $2 = name of the branch
|
||||
# $3 = base ref name (master, 5.1.x, 5.2.x, etc...)
|
||||
# $4 = if given, update the VERSION_NUMBER
|
||||
|
||||
|
||||
if uname | grep -q -i cygwin; then
|
||||
#Is supposed to ignore \r as eol character.
|
||||
export SHELLOPTS
|
||||
set -o igncr
|
||||
fi
|
||||
source "$(dirname $0)/.autofilterrc"
|
||||
USER_REPO=$1
|
||||
BRANCH_NAME=$2
|
||||
BASE_NAME=$3
|
||||
cd ${CGAL_ROOT}
|
||||
scp mgimeno@cgal.geometryfactory.com:public_html/test_suite/VERSION_NUMBER .
|
||||
cd ${CGAL_GIT_DIR}
|
||||
if [ ! -d cgal ]; then
|
||||
git clone --depth 1 --no-single-branch https://github.com/CGAL/cgal.git
|
||||
cd cgal
|
||||
git remote rename origin cgal
|
||||
cd ..
|
||||
fi
|
||||
cd cgal
|
||||
git fetch --depth 1 cgal
|
||||
git remote add $USER_REPO https://github.com/$USER_REPO/cgal.git
|
||||
git fetch --depth 1 $USER_REPO
|
||||
git checkout $BRANCH_NAME
|
||||
git reset --hard $USER_REPO/$BRANCH_NAME
|
||||
#setup the list_test_packages
|
||||
LIST_OF_PKGS=$(git diff --name-only HEAD cgal/$BASE_NAME |cut -s -d/ -f1 |sort -u | xargs -I {} ls -d {}/package_info 2>/dev/null |cut -d/ -f1 |egrep -v Installation||true)
|
||||
if [ "$LIST_OF_PKGS" != "" ]; then
|
||||
if [ -f ${CGAL_ROOT}/list_test_packages ]; then rm ${CGAL_ROOT}/list_test_packages; fi
|
||||
for f in $LIST_OF_PKGS
|
||||
do
|
||||
echo "echo \"$f\"" >> ${CGAL_ROOT}/list_test_packages
|
||||
echo "echo \"${f}_Examples\"" >> ${CGAL_ROOT}/list_test_packages
|
||||
echo "echo \"${f}_Demo\"" >> ${CGAL_ROOT}/list_test_packages
|
||||
done
|
||||
fi
|
||||
(
|
||||
#create the release from the branch
|
||||
echo " Create release..."
|
||||
cmake -DGIT_REPO=${CGAL_GIT_DIR}/cgal -DDESTINATION=${CGAL_ROOT}/CGAL-TEST -DPUBLIC=OFF -DTESTSUITE=ON -DCGAL_VERSION=0.0-Ic-$(cat ${CGAL_ROOT}/VERSION_NUMBER) -P ${CGAL_GIT_DIR}/cgal/Scripts/developer_scripts/cgal_create_release_with_cmake.cmake | tee log
|
||||
echo "done."
|
||||
DEST=$(sed -E 's/.*CGAL-TEST\/(.*)/\1/' log);
|
||||
|
||||
cd ${CGAL_ROOT}
|
||||
|
||||
if [ -L CGAL-I ]; then rm CGAL-I; fi
|
||||
ln -s $PWD/CGAL-TEST/$DEST CGAL-I
|
||||
echo "starting testsuite..."
|
||||
|
||||
./autotest_cgal -c
|
||||
)>${CGAL_ROOT}/autotest.log2 2>&1 &
|
||||
echo "finished."
|
||||
if [ -n "$4" ]; then
|
||||
cd ${CGAL_ROOT}
|
||||
V=$(cat VERSION_NUMBER)
|
||||
V=$(($V+1))
|
||||
echo $V > VERSION_NUMBER
|
||||
scp VERSION_NUMBER mgimeno@cgal.geometryfactory.com:public_html/test_suite/VERSION_NUMBER
|
||||
fi
|
||||
|
||||
echo "exit."
|
||||
exit 0
|
||||
Loading…
Reference in New Issue