Update IFCTunnelDep3_Sys.ifc #348
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "IFC schema & usage check" | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "**.ifc" | |
jobs: | |
filter: | |
runs-on: ubuntu-latest | |
outputs: | |
hasifcs: ${{ steps.file_changes.outputs.any_changed }} | |
allchangedfiles: ${{ steps.file_changes.outputs.all_changed_files }} | |
removedfiles: ${{ steps.file_changes.outputs.deleted_files }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. | |
- name: Get changed files | |
id: file_changes | |
uses: tj-actions/changed-files@v42 | |
with: | |
files: | | |
**/*.ifc | |
separator: "§" | |
- name: Logging | |
run: | | |
echo 'The following files were identified for checking:' >> $GITHUB_STEP_SUMMARY | |
echo '' >> $GITHUB_STEP_SUMMARY | |
IFS='\§' | |
files="${{ steps.file_changes.outputs.all_changed_files }}" | |
deletedFiles=("${{ steps.file_changes.outputs.deleted_files }}") | |
for i in $files; do | |
[[ ! " ${deletedFiles[*]} " =~ " ${i} " ]] && echo '- ' $i >> $GITHUB_STEP_SUMMARY | |
done | |
echo '' >> $GITHUB_STEP_SUMMARY | |
check-ifc: | |
runs-on: windows-latest | |
needs: filter | |
if: ${{ needs.filter.outputs.hasifcs == 'true' }} | |
defaults: | |
run: | |
shell: pwsh | |
outputs: | |
hasfailing: ${{ steps.output.outputs.hasfailing }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Verify the workspace context | |
run: echo 'Workspace directory is ${{ github.workspace }}' | |
- name: Download the file | |
id: downloadfile | |
run: | | |
mkdir download | |
$urlPath = "https://thc.lyforms.app/documents/thc/public/IFChecker.TunnelDeployment" | |
$path = "${{ github.workspace }}\download\IFChecker.TunnelDeployment" | |
Invoke-WebRequest -URI $urlPath -OutFile $path | |
Expand-Archive $path -DestinationPath "${{ github.workspace }}\.github\workflows\" | |
- name: Check IFC files | |
id: checker | |
run: | | |
mkdir results | |
$removed = "${{ needs.filter.outputs.removedfiles }}" | |
$cmnd = "${{ github.workspace }}\.github\workflows\IFChecker.TunnelDeployment.exe" | |
"${{ needs.filter.outputs.allchangedfiles }}".Split("\§") | ForEach { | |
if( $removed -contains $_ ) {continue} | |
$filename = $("$_").Substring($("$_").LastIndexOf("/")+1) | |
if( [IO.Path]::GetExtension($filename) -ne ".ifc" ) {continue} | |
$ifcFilePath = $("${{ github.workspace }}\$_") | |
$outFilePath = $("${{ github.workspace }}\results\Report_$filename.md") | |
Write-Host "Checking:" "$("$filename")" "$("$ifcFilePath")" " --> writing to" "$("$outFilePath")" | |
& $cmnd $ifcFilePath $outFilePath "Sprint_1.1" | |
Write-Host "Last exit code was:" "$LastExitCode" | |
} | |
- name: Upload check results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: IFC_check_results | |
path: ${{ github.workspace }}\results | |
if-no-files-found: error | |
- name: Publish results | |
id: results | |
run: | | |
dir results | |
Get-ChildItem -Path .\results\*.ifc.md | ForEach { | |
Get-Content $_.FullName | ForEach { | |
echo $_ >> $env:GITHUB_STEP_SUMMARY | |
} | |
echo "---" >> $env:GITHUB_STEP_SUMMARY | |
echo "---" >> $env:GITHUB_STEP_SUMMARY | |
} | |
- name: Prepare output | |
id: output | |
run: | | |
echo "hasfailing=false" >> $env:GITHUB_OUTPUT | |
Get-ChildItem -Path .\results\*Full.md | ForEach { | |
if( (Get-Content $_.FullName | ForEach-Object {$_ -match "failing|exception"}) -contains $True ) { | |
echo "hasfailing=true" >> $env:GITHUB_OUTPUT | |
break | |
} | |
} | |
inform-ifc: | |
runs-on: ubuntu-latest | |
needs: check-ifc | |
steps: | |
- name: Inform failure | |
if: ${{ needs.check-ifc.outputs.hasfailing == 'true' }} | |
id: inform_failure | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.setFailed('The submitted IFC file(s) have mistakes. Review the report(s).') | |
- name: Inform correctness | |
if: ${{ needs.check-ifc.outputs.hasfailing == 'false' }} | |
id: inform_right | |
run: | | |
echo "# Success" >> $GITHUB_STEP_SUMMARY | |
echo "" | |
echo ":heavy_check_mark: Verification and validation were successful." >> $GITHUB_STEP_SUMMARY | |
echo ":heavy_check_mark: We could not find any mistakes in the submitted IFC file(s). :rocket:" >> $GITHUB_STEP_SUMMARY | |
echo "" | |
echo ":exclamation: Note: :exclamation:" | |
echo "This does not mean that the content is *completely* correct, though. :broken_heart:" >> $GITHUB_STEP_SUMMARY | |
echo "We are not checking everything, only what is required by the current [sprint](https://github.com/bSI-InfraRoom/IFC-Tunnel-Deployment/tree/main/sprints)." >> $GITHUB_STEP_SUMMARY | |