Skip to content

Update Headers at Fri Oct 25 03:30:41 CEST 2024 #29

Update Headers at Fri Oct 25 03:30:41 CEST 2024

Update Headers at Fri Oct 25 03:30:41 CEST 2024 #29

name: PR Merge CI MAIN
on:
push:
branches:
- main
env:
CLOSE_BRANCH: 0
TEAM_RESTRICTIVE_CLOSED_BRANCH: ${{ secrets.TEAM_RESTRICTIVE_CLOSED_BRANCH }}
FROM_EMAIL: ${{ secrets.FROM_EMAIL }}
TO_EMAIL: ${{ secrets.TO_EMAIL }}
MAIL_RELAY: ${{ secrets.MAIL_RELAY }}
QA_TIMEOUT_PER_TEST_LINUX: 150
QA_TIMEOUT_PER_TEST_WIN: 500
jobs:
build_tools_linux:
if: ${{ github.repository_owner == 'OpenRadioss' }}
# DEV ONLY # runs-on: ["linux64","dev_pmci"]
runs-on: ["linux64","prmerge_ci"]
continue-on-error: true
container:
image: fr-qafactorydev.europe.altair.com/build-linux64_gf:cos8-ompi411-devts11
credentials:
username: ${{secrets.DOCKER_REGISTRY_USER}}
password: ${{secrets.DOCKER_REGISTRY_PASSWD}}
volumes:
- /etc/localtime:/etc/localtime:ro
env:
STATUS_BUILD: 0
os: linux64
steps:
# Set the working dir suffixed with branch name
- name: Set workdir
run: |
if [ "${{ github.base_ref }}" = "" ]
then
echo "WORKDIR=${{github.ref_name}}" >> $GITHUB_ENV
else
echo "WORKDIR=${{github.base_ref}}" >> $GITHUB_ENV
fi
- name: Create branch oriented WS directory & integration WS
run: |
mkdir -p ${{ env.WORKDIR }}
- name: Clean local exe dir
working-directory: ${{ env.WORKDIR }}
run: |
rm -rf exec
md5sum exec/* || echo "Nothing in exec/"
# Get last git modifications, don't clean before (way to keep persistent obj files)
- name: Checkout git sources
uses: actions/checkout@v4
with:
path: ${{ env.WORKDIR }}
clean: 'false'
lfs: 'true'
- name: Running builds
working-directory: ${{ env.WORKDIR }}
run: |
mkdir exec
source /home/adminqa/.bashrc
cmd="./build.bash"
echo "========================================="
echo "-- BUILD tools for anim_to_vtk (${{ env.os }}) --"
echo "-- $cmd --"
echo "========================================="
cd tools/anim_to_vtk/${{ env.os }}
eval $cmd
cmd="./build.bash"
echo "========================================="
echo "-- BUILD tools for anim_to_vtk (${{ env.os }}) --"
echo "-- $cmd --"
echo "========================================="
cd ../../th_to_csv/${{ env.os }}
eval $cmd
# Set correct end of step status (if not an email will be sent)
echo "STATUS_BUILD=1" >> $GITHUB_ENV
- name: Managing step execution
if: ${{ always() }}
run: |
MAILMSG="Some error(s) has(ve) been raised during workflow execution:\n\n"
echo -e "\n#### STATUS_STEP_BUILD ${{ env.os }} ###"
if [ "$STATUS_BUILD" = 0 ]
then
echo -e "Status\t[ \033[31;2;1mFAILED\033[0m ]"
MAILMSG="The build tools ${{ env.os }} has failed \n"
# Send email
# Setting SMTP server (docker host)
DOCKER_HOST=`/sbin/ip route|awk '/default/ { print $3 }'`
echo "set smtp=smtp://${DOCKER_HOST}:25" >> /etc/mail.rc
# Print message in log
echo -e $MAILMSG
# Send email
echo -e "$MAILMSG" | Mail -r $FROM_EMAIL -s "Error in Github CI repo ${{ github.repository }} (${{github.sha}})" $TO_EMAIL
else
echo -e "Status\t[ \033[32;2;1mOK\033[0m ]"
fi
# Upload artifact
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: tools-${{ env.os }}
path: ${{ env.WORKDIR }}/exec
build_tools_windows_no_container:
if: ${{ github.repository_owner == 'OpenRadioss' }}
runs-on: ["win64","build","prmerge_ci"]
continue-on-error: true
env:
STATUS_BUILD: 0
os: win64
steps:
# Set the working dir suffixed with branch name
- name: Set workdir
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
if [ \"${{ github.base_ref }}\" = \"\" ];
then
echo \"WORKDIR=${{github.ref_name}}\" >> $GITHUB_ENV;
else
echo \"WORKDIR=${{github.base_ref}}\" >> $GITHUB_ENV;
fi;
"
- name: Create branch oriented WS directory & integration WS (WIN64)
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
cd %cd:\=/%;
mkdir -p ${{ env.WORKDIR }};
"
- name: Clean local exe dir
working-directory: ${{ env.WORKDIR }}
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
cd %cd:\=/%;
rm -rf exec;
"
# Get last git modifications, don't clean before (way to keep persistent obj files)
- name: Checkout git sources
uses: actions/checkout@v4
with:
path: ${{ env.WORKDIR }}
clean: 'false'
lfs: 'true'
- name: Running builds
working-directory: ${{ env.WORKDIR }}
shell: cmd
run: >
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2019 && C:\cygwin64\bin\bash --login -c "
cd %cd:\=/%;
mkdir exec;
cmd=\"./build.bat\";
echo \"=========================================\";
echo \"-- BUILD tools for anim_to_vtk (${{ env.os }}) --\";
echo \"-- $cmd --\";
echo \"=========================================\";
cd tools/anim_to_vtk/${{ env.os }};
eval $cmd || exit 1;
cmd=\"./build.bat\";
echo \"=========================================\";
echo \"-- BUILD tools for anim_to_vtk (${{ env.os }}) --\";
echo \"-- $cmd --\";
echo \"=========================================\";
cd ../../th_to_csv/${{ env.os }};
eval $cmd || exit 1;
echo \"STATUS_BUILD=1\" >> $GITHUB_ENV;
"
- name: Managing step execution
if: ${{ always() }}
# Running cygwin from powershell or cmd => neither identation nor comment !
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
MAILMSG=\"Some error(s) has(ve) been raised during workflow execution:\n\n\";
echo -e \"\n#### STATUS_STEP_BUILD ${{ env.os }} ###\";
if [ ${{ env.STATUS_BUILD }} = 0 ];
then
echo -e \"Status\t[ \033[31;2;1mFAILED\033[0m ]\";
MAILMSG+=\"The build tools ${{ env.os }} has failed \n\";
echo -e $MAILMSG;
echo -e \"$MAILMSG\" | Email -f $FROM_EMAIL -s \"Error in Github CI repo ${{ github.repository }} (${{github.sha}})\" -r $MAIL_RELAY $TO_EMAIL;
exit 1;
else
echo -e \"Status\t[ \033[32;2;1mOK\033[0m ]\";
fi;
"
# Upload artifact
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: tools-${{ env.os }}
path: ${{ env.WORKDIR }}/exec
build_linux:
if: ${{ github.repository_owner == 'OpenRadioss' }}
# DEV ONLY # runs-on: ["${{ matrix.build }}","dev_pmci"]
runs-on: ["${{ matrix.build }}","prmerge_ci"]
container:
image: fr-qafactorydev.europe.altair.com/build-linux64_gf:cos8-ompi411-devts11
credentials:
username: ${{secrets.DOCKER_REGISTRY_USER}}
password: ${{secrets.DOCKER_REGISTRY_PASSWD}}
volumes:
- /etc/localtime:/etc/localtime:ro
env:
BUILD_NB_THREAD: 2
STATUS_BUILD: 0
SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }}
strategy:
# If one job fails others are canceled
fail-fast: true
matrix:
include:
- build: starter_linux64_gf
precision: dp
os: linux64
binary: starter
- build: starter_linux64_gf_sp
precision: sp
os: linux64
binary: starter
- build: engine_linux64_gf_ompi
precision: dp
os: linux64
binary: engine
mpi: ompi
- build: engine_linux64_gf_ompi_sp
precision: sp
os: linux64
binary: engine
mpi: ompi
- build: engine_linux64_gf
precision: dp
os: linux64
binary: engine
- build: engine_linux64_gf_sp
precision: sp
os: linux64
binary: engine
steps:
# Set the working dir suffixed with branch name
- name: Set workdir
run: |
if [ "${{ github.base_ref }}" = "" ]
then
echo "WORKDIR=${{github.ref_name}}" >> $GITHUB_ENV
else
echo "WORKDIR=${{github.base_ref}}" >> $GITHUB_ENV
fi
- name: Create branch oriented WS directory & integration WS
run: |
mkdir -p ${{ env.WORKDIR }}
- name: Clean local exe dir
working-directory: ${{ env.WORKDIR }}
run: |
rm -rf exec
md5sum exec/* || echo "Nothing in exec/"
# Get last git modifications, don't clean before (way to keep persistent obj files)
- name: Checkout git sources
uses: actions/checkout@v4
with:
path: ${{ env.WORKDIR }}
clean: 'false'
lfs: 'true'
- name: Running build
working-directory: ${{ env.WORKDIR }}
run: |
mpi_opts=''
if [ ! -z ${{ matrix.mpi }} ]
then
mpi_opts="-mpi=${{ matrix.mpi }}"
fi
cmd="./build_script.sh -release -arch=${{ matrix.os }}_gf -prec=${{ matrix.precision }} -nt=${{ env.BUILD_NB_THREAD }} -static-link $mpi_opts"
echo "========================================="
echo "-- BUILD ${{ matrix.build }} --"
echo "-- $cmd --"
echo "========================================="
source /home/adminqa/.bashrc
chmod 755 Compiling_tools/script/*
chmod 755 ${{ matrix.binary }}/build_script.sh
# USED for development only (avoid using lfs)
test ! -e extlib && ln -s /__w/_tool/extlib .
md5sum exec/* || echo "Nothing in exec/"
mkdir exec
cd ${{ matrix.binary }}
eval $cmd
cd ..
# Exiting with failure is no bins generated, should be handle by build_script soon
md5sum exec/* || exit 1
# Set correct end of step status (if not an email will be sent)
echo "STATUS_BUILD=1" >> $GITHUB_ENV
- name: Managing step execution
if: ${{ always() }}
run: |
MAILMSG="Some error(s) has(ve) been raised during workflow execution:\n\n"
echo -e "\n#### STATUS_STEP_BUILD ${{ matrix.build }} ###"
if [ "$STATUS_BUILD" = 0 ]
then
echo -e "Status\t[ \033[31;2;1mFAILED\033[0m ]"
MAILMSG+="The build ${{ matrix.build }} has failed \n"
# Send email
# Close the branch
echo "CLOSE_BRANCH=1" >> $GITHUB_ENV
# Setting SMTP server (docker host)
DOCKER_HOST=`/sbin/ip route|awk '/default/ { print $3 }'`
echo "set smtp=smtp://${DOCKER_HOST}:25" >> /etc/mail.rc
# Print message in log
echo -e $MAILMSG
# Send email
echo -e "$MAILMSG\nThe branch is closed" | Mail -r $FROM_EMAIL -s "Error in Github CI repo ${{ github.repository }} (${{github.sha}})" $TO_EMAIL
# Exit fail to see it as a failure
exit 1
else
echo -e "Status\t[ \033[32;2;1mOK\033[0m ]"
fi
# Upload artifact (since V4 we can't upload artifact using the same name, each one must be unique)
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: bins-${{ matrix.os }}-${{ matrix.precision }}-${{ matrix.build }}
path: ${{ env.WORKDIR }}/exec
if: ${{ env.CLOSE_BRANCH == 0 }}
# Close the branch (= restrict push to team devopsadmins) if needed
# Owner is not mandatory here ... PAT is sufficient ??? seems that as servbot has permissions on this repo so his PAT is sufficient ...
- uses: octokit/request-action@v2.x
id: close_branch_build
env:
GITHUB_TOKEN: ${{ env.SERVBOT_PAT }}
REQUEST_BODY: "['${{ env.TEAM_RESTRICTIVE_CLOSED_BRANCH}}']"
with:
route: PUT /repos/${{ github.repository }}/branches/main/protection/restrictions/teams
data: ${{ env.REQUEST_BODY }}
if: ${{ always() && env.CLOSE_BRANCH == 1 }}
# It the closing went wrong we send an email
- name: "Check result of closing branch and warn if it fails"
run: |
# No need to configure SMTP server, already done in previous steps
MAILMSG="Some error(s) has(ve) been raised during workflow execution:\n\n"
MAILMSG+="A branch closing is needed but has failed\n\n"
MAILMSG+="Return status API is : ${{ steps.close_branch_build.outputs.status }}\n\n"
MAILMSG+="Check more detailed datas in CI logs\n"
# Print message in log
echo -e $MAILMSG
echo -e "\nClose return data API is : ${{ steps.close_branch_build.outputs.data }}"
# Send email
echo -e "$MAILMSG" | Mail -r $FROM_EMAIL -s "Error in Github CI repo ${{ github.repository }} (${{github.sha}}) on closing branch" $TO_EMAIL
# Exit fail to see it as a failure
exit 1
if: ${{ always() && env.CLOSE_BRANCH == 1 && steps.close_branch_build.outputs.status != 200 }}
qa_linux:
needs: build_linux
# DEV ONLY # runs-on: ["qa_${{ matrix.os }}","dev"]
runs-on: ["qa_${{ matrix.os }}","prmerge_ci"]
container:
image: fr-qafactorydev.europe.altair.com/qa-linux64_gf:cos8-ompi411
credentials:
username: ${{secrets.DOCKER_REGISTRY_USER}}
password: ${{secrets.DOCKER_REGISTRY_PASSWD}}
volumes:
- /etc/localtime:/etc/localtime:ro
env:
hm_reader_extlib: ../../extlib/hm_reader
hm_reader_cfgfiles: ../../hm_cfg_files
homeuser: /home/adminqa
mpi: ompi
STATUS_QA: 0
SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }}
# DEV ONLY # QA_NB_PROC: 2
QA_NB_PROC: 4
QA_NB_THREAD: 2
strategy:
# If one job fails others continue
fail-fast: false
matrix:
os: [linux64]
# precision: [dp,sp]
precision: [dp]
steps:
# Get git related to the commit
- name: Checkout git sources
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Clean local exe dir
run: |
rm -rf exec
# Download artifacts (since V4 we must download all needed artifacts, we could do it using wildcard but it doesn't work ... see https://github.com/actions/download-artifact/issues/337)
# Using hard name waiting for this issue to be fixed
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: bins-${{ matrix.os }}-${{ matrix.precision }}-*
# path: exec
# merge-multiple: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
# name: "bins-${{ matrix.os }}-${{ matrix.precision }}-*"
name: bins-${{ matrix.os }}-${{ matrix.precision }}-starter_linux64_gf
path: exec
merge-multiple: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
# name: "bins-${{ matrix.os }}-${{ matrix.precision }}-*"
name: bins-${{ matrix.os }}-${{ matrix.precision }}-engine_linux64_gf_ompi
path: exec
merge-multiple: true
- name: Running qa
run: |
# USED for development only (avoid using lfs)
test ! -e extlib && ln -s /__w/_tool/extlib .
md5sum exec/* || echo "Nothing in exec/"
if [ "${{ matrix.precision }}" = "dp" ]
then
precision_ext=""
else
precision_ext="_${{ matrix.precision }}"
fi
chmod 755 exec/*
cd qa-tests/scripts
rm -f QA.summary
chmod 755 or_qa_script or_radioss.pl
source ${{ env.homeuser }}/.bashrc
export LD_LIBRARY_PATH=${{ env.hm_reader_extlib }}/${{ matrix.os }}:$LD_LIBRARY_PATH
cmd="./or_qa_script ../../exec/engine_${{ matrix.os }}_gf_${{ env.mpi }}${precision_ext} 1.0 --env:RAD_CFG_PATH=${{ env.hm_reader_cfgfiles }} --system_run --env:OMP_STACKSIZE=400m --exec_script_args='mpiexec -np ${{ env.QA_NB_PROC }}' --env:OMP_NUM_THREADS=${{ env.QA_NB_THREAD }} --output_failures_stdout --xtra_args='--timeoutscript=${{ env.QA_TIMEOUT_PER_TEST_LINUX }}'"
echo "========================================="
echo "-- QA ${{ matrix.os }}_${{ matrix.precision }} --"
echo "-- $cmd --"
echo "========================================="
eval $cmd
res=$?
# Getting failed test
nbtestsfailed=$(grep "# Runs Failed\s*:" QA.summary | tail -n 1 | awk -F' ' '{print $5}')
# Checking if no test has run at all (maybe exec errors)
nbtestsok=$(grep "# Runs Successful\s*:" QA.summary | tail -n 1 | awk -F' ' '{print $5}')
if [ $res = 0 ] && [ $nbtestsfailed = 0 ] && [ $nbtestsok -gt 0 ]
then
# Set correct end of step status (if not an email will be sent)
echo "STATUS_QA=1" >> $GITHUB_ENV
fi
- name: Managing step execution
if: ${{ always() }}
run: |
MAILMSG="Some error(s) has(ve) been raised during workflow execution:\n\n"
echo -e "\n#### STATUS_STEP_QA ###"
if [ "$STATUS_QA" = 0 ]
then
echo -e "Status\t[ \033[31;2;1mFAILED\033[0m ]"
MAILMSG+="The QA ${{ matrix.os }}-${{ matrix.precision }} has failed \n"
# Send email
# Close the branch
echo "CLOSE_BRANCH=1" >> $GITHUB_ENV
# Setting SMTP server (docker host)
DOCKER_HOST=`/sbin/ip route|awk '/default/ { print $3 }'`
echo "set smtp=smtp://${DOCKER_HOST}:25" >> /etc/mail.rc
# Print message in log
echo -e $MAILMSG
# Send email
echo -e "$MAILMSG\nThe branch is closed" | Mail -r $FROM_EMAIL -s "Error in Github CI repo ${{ github.repository }} (${{github.sha}})" $TO_EMAIL
# Exit fail to see it as a failure
exit 1
else
echo -e "Status\t[ \033[32;2;1mOK\033[0m ]"
fi
# Close the branch (= restrict push to team devopsadmins) if needed
# Owner is not mandatory here ... PAT is sufficient ??? seems that as servbot has permissions on this repo so his PAT is sufficient ...
- uses: octokit/request-action@v2.x
id: close_branch_qa
env:
GITHUB_TOKEN: ${{ env.SERVBOT_PAT }}
REQUEST_BODY: "['${{ env.TEAM_RESTRICTIVE_CLOSED_BRANCH}}']"
with:
route: PUT /repos/${{ github.repository }}/branches/main/protection/restrictions/teams
data: ${{ env.REQUEST_BODY }}
if: ${{ always() && env.CLOSE_BRANCH == 1 }}
# It the closing went wrong we send an email
- name: "Check result of closing branch and warn if it fails"
run: |
# No need to configure SMTP server, already done in previous steps
MAILMSG="Some error(s) has(ve) been raised during workflow execution:\n\n"
MAILMSG+="A branch closing is needed but has failed\n\n"
MAILMSG+="Return status API is : ${{ steps.close_branch_qa.outputs.status }}\n\n"
MAILMSG+="Check more detailed datas in CI logs\n"
# Print message in log
echo -e $MAILMSG
echo -e "\nClose return data API is : ${{ steps.close_branch_qa.outputs.data }}"
# Send email
echo -e "$MAILMSG" | Mail -r $FROM_EMAIL -s "Error in Github CI repo ${{ github.repository }} (${{github.sha}}) on closing branch" $TO_EMAIL
# Exit fail to see it as a failure
exit 1
if: ${{ always() && env.CLOSE_BRANCH == 1 && steps.close_branch_qa.outputs.status != 200 }}
build_windows_no_container:
if: ${{ github.repository_owner == 'OpenRadioss' }}
runs-on: ["${{ matrix.build }}","prmerge_ci"]
env:
BUILD_NB_THREAD: 2
STATUS_BUILD: 0
SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }}
CLOSE_BRANCH: 0
strategy:
# If one job fails others are canceled
fail-fast: true
matrix:
include:
- build: starter_win64
precision: dp
os: win64
binary: starter
- build: starter_win64_sp
precision: sp
os: win64
binary: starter
- build: engine_win64_impi
precision: dp
os: win64
binary: engine
mpi: impi
- build: engine_win64_impi_sp
precision: sp
os: win64
binary: engine
mpi: impi
- build: engine_win64
precision: dp
os: win64
binary: engine
- build: engine_win64_sp
precision: sp
os: win64
binary: engine
steps:
# Set the working dir suffixed with branch name
- name: Set workdir
run: |
if ([string]::IsNullOrEmpty($env:GITHUB_BASE_REF)) {
Add-Content -Path $env:GITHUB_ENV -Value "WORKDIR=$env:GITHUB_REF_NAME"
}
else {
Add-Content -Path $env:GITHUB_ENV -Value "WORKDIR=$env:GITHUB_BASE_REF"
}
- name: Create branch oriented WS directory & integration WS (WIN64)
run: |
$dir2create = "$env:WORKDIR"
if (-not (Test-Path -Path $dir2create)) {
New-Item -Path $dir2create -ItemType "Directory"
}
- name: Clean local exe dir
working-directory: ${{ env.WORKDIR }}
run: |
$dir2remove = "exec"
if (Test-Path -Path $dir2remove) {
Remove-Item -Path $dir2remove -Recurse -Force
}
# Get last git modifications, don't clean before (way to keep persistent obj files)
- name: Checkout git sources
uses: actions/checkout@v4
with:
path: ${{ env.WORKDIR }}
clean: 'false'
lfs: 'true'
- name: Running builds
working-directory: ${{ env.WORKDIR }}
run: |
cd ${{ matrix.binary }}
@"
@echo off
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2019
cmake --version
ninja --version
if not '${{ matrix.mpi }}'=='' (
set mpi_opts=-mpi=${{ matrix.mpi }}
)
echo =========================================
echo -- BUILD ${{ matrix.build }} --
echo =========================================
.\build_windows.bat -release -arch=${{ matrix.os }} -prec=${{ matrix.precision }} -nt=$env:BUILD_NB_THREAD %mpi_opts%
"@ -replace "'", '"' | Out-File -FilePath myrun.bat -Encoding ASCII
cmd /c .\myrun.bat
cd ..
$directoryPath = "exec"
if (Test-Path -Path $directoryPath) {
$files = Get-ChildItem -Path $directoryPath
if ($files.Count -eq 0) {
Write-Output "The directory is empty."
exit 1
} else {
# Display the contents of the directory
$files | ForEach-Object { Write-Output $_.FullName }
}
} else {
Write-Output "The directory does not exist."
exit 1
}
Add-Content -Path $env:GITHUB_ENV -Value "STATUS_BUILD=1"
- name: Managing step execution
if: ${{ always() }}
run: |
$MAILMSG = "Some error(s) has(ve) been raised during workflow execution:`r`n`r`n"
Write-Output "`r`n#### STATUS_STEP_BUILD ${{ matrix.build }} ($env:STATUS_BUILD) ###"
if ($env:STATUS_BUILD -eq 0) {
Write-Output "Status`t[ $([char]27)[31;2;1mFAILED$([char]27)[0m ]"
$MAILMSG += "The build ${{ matrix.build }} has failed `r`n"
Add-Content -Path $env:GITHUB_ENV -Value "CLOSE_BRANCH=1"
Send-MailMessage -SmtpServer $env:MAIL_RELAY -From $env:FROM_EMAIL -To $env:TO_EMAIL -Subject "Error in Github CI repo ${{ github.repository }} (${{github.sha}})" -Body $MAILMSG -Port 25
exit 1
}
else {
Write-Output "Status`t[ $([char]27)[32;2;1mOK$([char]27)[0m ]"
}
# Upload artifact (since V4 we can't upload artifact using the same name, each one must be unique)
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: bins-${{ matrix.os }}-${{ matrix.precision }}-${{ matrix.build }}
path: ${{ env.WORKDIR }}/exec
if: ${{ env.CLOSE_BRANCH == 0 }}
# Close the branch (= restrict push to team devopsadmins) if needed
# Owner is not mandatory here ... PAT is sufficient ??? seems that as servbot has permissions on this repo so his PAT is sufficient ...
- name: Close the branch if errors
uses: octokit/request-action@v2.x
id: close_branch_build
env:
GITHUB_TOKEN: ${{ env.SERVBOT_PAT }}
REQUEST_BODY: "['${{ env.TEAM_RESTRICTIVE_CLOSED_BRANCH}}']"
with:
route: PUT /repos/${{ github.repository }}/branches/main/protection/restrictions/teams
data: ${{ env.REQUEST_BODY }}
if: ${{ always() && env.CLOSE_BRANCH == 1 }}
# If the closing went wrong we send an email
- name: "Check result of closing branch and warn if it fails"
run: |
$MAILMSG = "Some error(s) has(ve) been raised during workflow execution:`r`n`r`n"
$MAILMSG += "A branch closing is needed but has failed`r`n`r`n"
$MAILMSG += "Return status API is : ${{ steps.close_branch_build.outputs.status }}`r`n`r`n"
$MAILMSG += "Check more detailed datas in CI logs`r`n"
Write-Output "`r`nClose return API is : ${{ steps.close_branch_build.outputs.status }} / ${{ steps.close_branch_build.outputs.data }}";
Send-MailMessage -SmtpServer $env:MAIL_RELAY -From $env:FROM_EMAIL -To $env:TO_EMAIL -Subject "Error in Github CI repo ${{ github.repository }} (${{github.sha}}) on closing branch" -Body $MAILMSG -Port 25
exit 1
if: ${{ always() && env.CLOSE_BRANCH == 1 && steps.close_branch_build.outputs.status != 200 }}
qa_windows_no_container:
needs: build_windows_no_container
runs-on: ["qa_${{ matrix.os }}","prmerge_ci"]
env:
hm_reader_extlib: ../../extlib/hm_reader
hm_reader_cfgfiles: ../../hm_cfg_files
oneapi_exlib: ../../EXTRA/win64/extlib/intelOneAPI_runtime
mpi: impi
STATUS_QA: 0
SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }}
# DEV ONLY # QA_NB_PROC: 2
QA_NB_PROC: 4
QA_NB_THREAD: 2
strategy:
# If one job fails others continue
fail-fast: false
matrix:
os: [win64]
# precision: [dp,sp]
precision: [dp]
steps:
# Get git related to the commit
- name: Checkout git sources
uses: actions/checkout@v4
with:
lfs: 'true'
# Get OpenRadioss extras from dedicated repository
- name: Checkout git EXTRA sources
uses: actions/checkout@v4
with:
lfs: 'true'
clean: 'false'
repository: '${{ secrets.EXTRA_REPOSITORY }}'
path: 'EXTRA'
token: '${{ secrets.EXTRA_REPOSITORY_PAT }}'
- name: Clean local exe dir
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
cd %cd:\=/%;
rm -rf exec;
"
# Download artifacts (since V4 we must download all needed artifacts, we could do it using wildcard but it doesn't work ... see https://github.com/actions/download-artifact/issues/337)
# Using hard name waiting for this issue to be fixed
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: bins-${{ matrix.os }}-${{ matrix.precision }}-*
# path: exec
# merge-multiple: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
# name: "bins-${{ matrix.os }}-${{ matrix.precision }}-*"
name: bins-${{ matrix.os }}-${{ matrix.precision }}-starter_win64
path: exec
merge-multiple: true
- name: Download artifacts
uses: actions/download-artifact@v4
with:
# name: "bins-${{ matrix.os }}-${{ matrix.precision }}-*"
name: bins-${{ matrix.os }}-${{ matrix.precision }}-engine_win64_impi
path: exec
merge-multiple: true
- name: Running qa
# Running cygwin from powershell or cmd => neither identation nor comment !
shell: cmd
run: >
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2019 && C:\cygwin64\bin\bash --login -c "
cd %cd:\=/%;
md5sum exec/* || echo \"Nothing in exec/\";
if [ \"${{ matrix.precision }}\" = \"dp\" ];
then
precision_ext='';
else
precision_ext=\"_${{ matrix.precision }}\";
fi;
/cygdrive/c/mybin/clean_win10.pl;
cd qa-tests/scripts;
rm -f QA.summary;
export PATH=${{ env.hm_reader_extlib }}/${{ matrix.os }}:$PATH;
export PATH=${{ env.oneapi_exlib }}/${{ matrix.os }}:$PATH;
cmd=\"./or_qa_script ../../exec/engine_${{ matrix.os }}_${{ env.mpi }}${precision_ext} 1.0 --env:RAD_CFG_PATH=${{ env.hm_reader_cfgfiles }} --system_run --env:KMP_STACKSIZE=400m --exec_script_args='mpiexec -np ${{ env.QA_NB_PROC }}' --env:OMP_NUM_THREADS=${{ env.QA_NB_THREAD }} --output_failures_stdout --xtra_args='--timeoutscript=${{ env.QA_TIMEOUT_PER_TEST_WIN }}' \";
echo \"=========================================\";
echo \"-- QA ${{ matrix.os }}_${{ matrix.precision }} --\";
echo \"-- $cmd --\";
echo \"=========================================\";
eval $cmd || exit 1;
res=$?;
nbtestsfailed=$(grep \"# Runs Failed\s*:\" QA.summary | tail -n 1 | awk -F' ' '{print $5}');
nbtestsok=$(grep \"# Runs Successful\s*:\" QA.summary | tail -n 1 | awk -F' ' '{print $5}');
if [ $res = 0 ] && [ $nbtestsfailed = 0 ] && [ $nbtestsok -gt 0 ];
then
echo \"STATUS_QA=1\" >> $GITHUB_ENV;
fi;
"
- name: Managing step execution
if: ${{ always() }}
# Running cygwin from powershell or cmd => neither identation nor comment !
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
MAILMSG=\"Some error(s) has(ve) been raised during workflow execution:\n\n\";
echo -e \"\n#### STATUS_STEP_QA ###\";
if [ ${{ env.STATUS_QA }} = 0 ];
then
echo -e \"Status\t[ \033[31;2;1mFAILED\033[0m ]\";
MAILMSG+=\"The QA ${{ matrix.os }}-${{ matrix.precision }} has failed \n\";
echo \"CLOSE_BRANCH=1\" >> $GITHUB_ENV;
echo -e $MAILMSG;
echo -e \"$MAILMSG\nThe branch is closed\" | Email -f $FROM_EMAIL -s \"Error in Github CI repo ${{ github.repository }} (${{github.sha}})\" -r $MAIL_RELAY $TO_EMAIL;
exit 1;
else
echo -e \"Status\t[ \033[32;2;1mOK\033[0m ]\";
fi;
"
# Close the branch (= restrict push to team devopsadmins) if needed
# Owner is not mandatory here ... PAT is sufficient ??? seems that as servbot has permissions on this repo so his PAT is sufficient ...
- uses: octokit/request-action@v2.x
id: close_branch_qa
env:
GITHUB_TOKEN: ${{ env.SERVBOT_PAT }}
REQUEST_BODY: "['${{ env.TEAM_RESTRICTIVE_CLOSED_BRANCH}}']"
with:
route: PUT /repos/${{ github.repository }}/branches/main/protection/restrictions/teams
data: ${{ env.REQUEST_BODY }}
if: ${{ always() && env.CLOSE_BRANCH == 1 }}
# If the closing went wrong we send an email
- name: "Check result of closing branch and warn if it fails"
# Running cygwin from powershell or cmd => neither identation nor comment !
shell: cmd
run: >
call C:\cygwin64\bin\bash --login -c "
MAILMSG=\"Some error(s) has(ve) been raised during workflow execution:\n\n\";
MAILMSG+=\"A branch closing is needed but has failed\n\n\";
MAILMSG+=\"Return status API is : ${{ steps.close_branch_qa.outputs.status }}\n\n\";
MAILMSG+=\"Check more detailed datas in CI logs\n\";
echo -e $MAILMSG;
echo -e \"\nClose return data API is : ${{ steps.close_branch_qa.outputs.data }}\";
echo -e \"$MAILMSG\" | Email -f $FROM_EMAIL -s \"Error in Github CI repo ${{ github.repository }} (${{github.sha}}) on closing branch\" -r $MAIL_RELAY $TO_EMAIL;
exit 1;
"
if: ${{ always() && env.CLOSE_BRANCH == 1 && steps.close_branch_qa.outputs.status != 200 }}
# Call the sync CI if build and qa are OK
# Secrets variables must be passed
call-workflow-sync-git2perforce:
needs: [qa_linux,qa_windows_no_container]
uses: ./.github/workflows/prmerge_ci_sync.yml
secrets:
DOCKER_REGISTRY_USER: ${{secrets.DOCKER_REGISTRY_USER}}
DOCKER_REGISTRY_PASSWD: ${{secrets.DOCKER_REGISTRY_PASSWD}}
SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }}
FROM_EMAIL: ${{ secrets.FROM_EMAIL }}
TO_EMAIL: ${{ secrets.TO_EMAIL }}
GITLAB_PAT: "${{ secrets.GITLAB_PAT }}"
GITLAB_REPO_URL: "${{ secrets.GITLAB_REPO_URL }}"
GITLAB_SERVBOT_USER: ${{ secrets.GITLAB_SERVBOT_USER }}
GITLAB_SERVBOT_EMAIL: ${{ secrets.GITLAB_SERVBOT_EMAIL }}
update_counters:
# DEV ONLY # runs-on: dev_delivery
# runs-on: dev_delivery
if: ${{ github.repository_owner == 'OpenRadioss' }}
runs-on: delivery
container:
image: fr-qafactorydev.europe.altair.com/common-linux64
credentials:
username: ${{secrets.DOCKER_REGISTRY_USER}}
password: ${{secrets.DOCKER_REGISTRY_PASSWD}}
volumes:
- /etc/localtime:/etc/localtime:ro
# DEV ONLY # - /github_download_counter_dev:/github_download_counter
- /github_download_counter:/github_download_counter
env:
SERVBOT_USER: ${{ secrets.SERVBOT_USER }}
SERVBOT_PAT: ${{ secrets.SERVBOT_PAT }}
steps:
- name: Set variables
run: |
echo "DATEOFTHEDAY=`date +'%Y%m%d'`" >> $GITHUB_ENV
- name: Counter Download - Update values
run: |
cd /github_download_counter
# Do some before using some lock and retry stuff
cp download_count.json sav-merge-main-${{ env.DATEOFTHEDAY }}-download_count.json
github_download_count.py \
--git_api_url ${{ github.api_url }} \
--git_repo ${{ github.repository }} \
--git_user $SERVBOT_USER \
--git_token $SERVBOT_PAT \
--action update_values