Skip to content

Commit

Permalink
add new local composit action "files-check" to simplify workflow code
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Dec 7, 2024
1 parent c295c34 commit beb9e78
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 134 deletions.
29 changes: 29 additions & 0 deletions .github/actions/files-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: check-file-list
description: 'Checking files in the list'

inputs:
path:
description: 'path where to check'
default: ''
list:
description: 'list of files to check'
default: ''
runs:
using: composite
steps:
- name: Check file list
working-directory: ${{inputs.path}}
run: |
missing_files=
for fname in ${{inputs.list}}; do
if [[ ! -f "$fname" ]]; then
echo "Build result not found: $fname"
missing_files=$missing_files $fname
fi
done
if [[ ! -z "$missing_files" ]]; then
echo "Missing build outputs: $missing_files"
echo "One or more expected outputs are missing - failing build"
exit 1
fi
shell: bash
189 changes: 55 additions & 134 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -718,20 +718,14 @@ jobs:
call mk.bat
call mkdist.bat
REM Check outputs
set MISSING_BUILD_RESULTS=
for %%y in (${{env.STANDARD_BUILD_OUTPUTS}}) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd

- name: Full Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
list: ${{env.STANDARD_BUILD_OUTPUTS}}

- name: Fetch CA Certs bundle
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -979,19 +973,12 @@ jobs:
cd ..\k95
call mk.bat
call mkdist.bat
echo Check outputs...
set MISSING_BUILD_RESULTS=
for %%y in (${{env.STANDARD_BUILD_OUTPUTS}}) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Full Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
list: ${{env.STANDARD_BUILD_OUTPUTS}}

- name: Fetch CA Certs bundle
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -1078,24 +1065,13 @@ jobs:
call mk.bat
call mkdist.bat
REM Check outputs
REM ctl3d.exe
set MISSING_BUILD_RESULTS=
REM Can't use STANDARD_BUILD_OUTPUTS as we're not building k95crypt.dll
REM here for some reason.
for %%y in (k95.exe iksd.exe iksdsvc.exe k95d.exe rlogin.exe telnet.exe textps.exe k95g.exe p95.dll) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Full Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
list: 'k95.exe iksd.exe iksdsvc.exe k95d.exe rlogin.exe telnet.exe textps.exe k95g.exe p95.dll'

- name: Dialer Build
env:
ROOT: ${{ github.workspace }}
Expand All @@ -1105,19 +1081,13 @@ jobs:
call mk.bat
call mkdist.bat
set MISSING_BUILD_RESULTS=
for %%y in (k95dial.exe k95regtl.exe) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Dialer Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\dialer\dist'
list: 'k95dial.exe k95regtl.exe'

- name: Prepare Artifacts
working-directory: ${{ github.workspace }}\kermit\k95
run: |
Expand Down Expand Up @@ -1189,23 +1159,12 @@ jobs:
call mk.bat
call mkdist.bat
REM Check outputs
REM ctl3d.exe
set MISSING_BUILD_RESULTS=
REM Can't use STANDARD_BUILD_OUTPUTS as we're not building k95crypt.dll
REM here for some reason.
for %%y in (k95.exe iksd.exe iksdsvc.exe k95d.exe rlogin.exe telnet.exe textps.exe k95g.exe p95.dll) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Full Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
list: 'k95.exe iksd.exe iksdsvc.exe k95d.exe rlogin.exe telnet.exe textps.exe k95g.exe p95.dll'

- name: Fetch Docs
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -1319,19 +1278,13 @@ jobs:
call mkos2.bat
call mkdist-os2.bat
REM Check outputs
set MISSING_BUILD_RESULTS=
for %%y in (${{env.OS2_BUILD_OUTPUTS}}) do (
if not exist dist-os2\%%y echo Build result not found: %%y
if not exist dist-os2\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist-os2\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Kermit/2 Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist-os2'
list: ${{env.OS2_BUILD_OUTPUTS}}

- name: Dialer Build
env:
ROOT: ${{ github.workspace }}
Expand Down Expand Up @@ -1663,20 +1616,12 @@ jobs:
call mk.bat

call mkdist.bat

REM Check outputs
set MISSING_BUILD_RESULTS=
REM ctl3dins.exe
for %%y in (k95.exe iksd.exe iksdsvc.exe k95d.exe rlogin.exe telnet.exe textps.exe k95g.exe p95.dll) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)

if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Full Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
list: 'k95.exe iksd.exe iksdsvc.exe k95d.exe rlogin.exe telnet.exe textps.exe k95g.exe p95.dll'

- name: Full Build Non-standard configs
env:
Expand Down Expand Up @@ -1715,38 +1660,21 @@ jobs:
mkdir dist-misc
move *.exe dist-misc
REM Check outputs
set MISSING_BUILD_RESULTS=
for %%y in (cknkui.exe) do (
if not exist dist-misc\%%y echo Build result not found: %%y
if not exist dist-misc\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist-misc\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Full Build Non-standard configs Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist-misc'
list: 'cknkui.exe'

- name: Check additional legacy outputs
if: matrix.legacy_dependencies == 'yes'
working-directory: ${{ github.workspace }}\kermit\k95
run: |
REM Check outputs
set MISSING_BUILD_RESULTS=
REM TODO: srp-tconf.exe srp-passwd.exe
REM TODO: Kerberos bits
for %%y in (k95crypt.dll) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing legacy build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
# TODO: srp-tconf.exe srp-passwd.exe
# TODO: Kerberos bits
list: 'k95crypt.dll'

- name: Fetch CA Certs bundle
if: matrix.legacy_dependencies == 'yes'
Expand Down Expand Up @@ -1934,19 +1862,12 @@ jobs:
call mk.bat
call mkdist.bat
REM Check outputs
set MISSING_BUILD_RESULTS=
for %%y in (${{env.STANDARD_BUILD_OUTPUTS}}) do (
if not exist dist\%%y echo Build result not found: %%y
if not exist dist\%%y set MISSING_BUILD_RESULTS=%MISSING_BUILD_RESULTS% %%y
if not exist dist\%%y set FAILED=yes
)
if "%MISSING_BUILD_RESULTS%" NEQ "" echo Missing build outputs: %MISSING_BUILD_RESULTS%
if "%MISSING_BUILD_RESULTS%" NEQ "" echo One or more expected outputs are missing - failing build
if "%MISSING_BUILD_RESULTS%" NEQ "" exit /b 1
shell: cmd
- name: Full Build Files Check
uses: "./.github/actions/files-check"
with:
path: 'kermit\k95\dist'
list: ${{env.STANDARD_BUILD_OUTPUTS}}

- name: Fetch Docs
uses: actions/download-artifact@v4
Expand Down

0 comments on commit beb9e78

Please sign in to comment.