Make OS2 zip fit on 1.4MB disk. Create second disk for compiler binar… #240
This file contains hidden or 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: Lua for Watcom | ||
| on: push | ||
| jobs: | ||
| Watcom: | ||
| name: Build Lua with Open Watcom | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Install Open Watcom 1.9 | ||
| uses: open-watcom/setup-watcom@v0 | ||
| with: | ||
| version: "1.9" | ||
| - name: Install Other Tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc libfaketime libreadline-dev lua5.4 make mtools zip | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| fetch-depth: 0 | ||
| - name: Test libfaketime works | ||
| run: | | ||
| export FAKETIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%d %H:%M:%S' --format="%cd") | ||
| export LD_PRELOAD=$(dpkg -L libfaketime | grep libfaketime.so.1) | ||
| DATE=$(date +"%Y-%m-%d %H:%M:%S") | ||
| echo "Date: $DATE" | ||
| echo "Faketime: $FAKETIME" | ||
| echo "ld-preload: $LD_PRELOAD" | ||
| if [ "$FAKETIME" != "$DATE" ]; then | ||
| exit 1 | ||
| fi | ||
| - name: Patch Lua Source Code for Open Watcom | ||
| run: | | ||
| lua scripts/dev/PATCH.LUA lua.pat luac.pat | ||
| - name: Check GCC can build Lua after patches | ||
| run: | | ||
| cd lua | ||
| make -j`nproc` | ||
| cd .. | ||
| - name: Build Lua for DOS 16-bit | ||
| env: | ||
| INCLUDE: "${{ env.WATCOM }}/h" | ||
| run: | | ||
| wmake -f wm_dos16.mak lua luac | ||
| - name: Build Lua for DOS4GW 32-bit Extender | ||
| env: | ||
| INCLUDE: "${{ env.WATCOM }}/h" | ||
| run: | | ||
| wmake -f wm_dos4g.mak lua luac | ||
| - name: Build Lua for Linux | ||
| env: | ||
| INCLUDE: "${{ env.WATCOM }}/lh" | ||
| run: | | ||
| wmake -f wm_linux.mak lua luac | ||
| - name: Build Lua for OS/2 16-bit | ||
| env: | ||
| INCLUDE: "${{ env.WATCOM }}/h/os2:${{ env.WATCOM }}/h" | ||
| run: | | ||
| wmake -f wm_os216.mak lua luac | ||
| - name: Build Lua for OS/2 32-bit | ||
| env: | ||
| INCLUDE: "${{ env.WATCOM }}/h/os2:${{ env.WATCOM }}/h" | ||
| run: | | ||
| wmake -f wm_os232.mak lua luac | ||
| - name: Build Lua for Windows 95 | ||
| env: | ||
| INCLUDE: "${{ env.WATCOM }}/h/nt:${{ env.WATCOM }}/h" | ||
| run: | | ||
| wmake -f wm_winnt.mak lua luac | ||
| - name: Copy DOS4GW Binary | ||
| run: | | ||
| cp $WATCOM/binw/dos4gw.exe dist/bin/DOS4GW.EXE | ||
| - name: Ensure Lua Scripts Have CR/LF Line Endings | ||
| run: | | ||
| lua scripts/util/DOSFREN.LUA scripts/meta/floppy/1440k/*/*.LUA | ||
| - name: Set constant time information on PE header | ||
| run: | | ||
| lua scripts/dev/PE95TIME.LUA dist/bin/LUANT.EXE | ||
| - name: Set modification time on scripts to their respective commit | ||
| run: | | ||
| cd scripts | ||
| git ls-files -z | xargs -0 -I{} bash -c 'touch --date="$(git log -1 --pretty=format:%cI -- "$0")" "$0"' {} | ||
| cd .. | ||
| - name: Remove UNIX executable permission from non-UNIX executable files | ||
| run: | | ||
| chmod -x dist/bin/*.EXE | ||
| - name: Set modification time on built binaries to the latest commit | ||
| run: | | ||
| touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.ELF dist/bin/*.EXE | ||
| - name: Create Binaries Zip | ||
| run: | | ||
| files=$(find dist/bin/*.EXE scripts/meta/floppy/1440k/*/*.LUA ! -executable | sort | xargs) | ||
| zip -j9 --DOS-names dist/LuaExe.zip $files | ||
| exe=$(find dist/bin/*.ELF scripts/meta/floppy/1440k/*/*.LUA -executable | sort | xargs) | ||
| zip -j9 -X dist/LuaExe.zip $exe | ||
| name="dist/WLE$(sha256sum dist/LuaExe.zip | awk '{print $1}' | cut -c1-5).zip" | ||
| mv dist/LuaExe.zip $name | ||
| touch --date="$(git log -1 --pretty=format:%cI)" $name | ||
| - name: UPX Binary Compression | ||
| uses: crazy-max/ghaction-upx@v3 | ||
| with: | ||
| version: latest | ||
| args: -9 --8086 | ||
| files: | | ||
| dist/bin/LUA16.EXE | ||
| dist/bin/LUA4G.EXE | ||
| dist/bin/LUANT.EXE | ||
| dist/bin/LUAC16.EXE | ||
| dist/bin/LUAC4G.EXE | ||
| dist/bin/LUACNT.EXE | ||
| - name: Squish Lua Scripts for Floppy Disk Images | ||
| run: | | ||
| find scripts -name "*.LUA" -type f -exec scripts/util/SQUISH.LUA {} + | ||
| find scripts -name "*.LUA" -type f -exec scripts/util/DOSFREN.LUA {} + | ||
| - name: Set modification time on UPX compressed binaries to the latest commit | ||
| run: | | ||
| touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.ELF dist/bin/*.EXE | ||
| - name: Set modification time on squished scripts to their respective commit | ||
| run: | | ||
| cd scripts | ||
| git ls-files -z | xargs -0 -I{} bash -c 'touch --date="$(git log -1 --pretty=format:%cI -- "$0")" "$0"' {} | ||
| cd .. | ||
| - name: Create 160k 16-bit DOS Floppy Diskette Image | ||
| run: | | ||
| export FAKETIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%d %H:%M:%S' --format="%cd") | ||
| export LD_PRELOAD=$(dpkg -L libfaketime | grep libfaketime.so.1) | ||
| label="LUA DOS" | ||
| serial="0x$(echo "$label$FAKETIME" | sha256sum | cut -c1-8)" | ||
| files=$(find dist/bin/LUA16.EXE scripts/meta/floppy/160k/1/*.LUA | sort | xargs) | ||
| echo "Faketime: $FAKETIME" | ||
| echo "Files: $files" | ||
| echo "Label: $label" | ||
| echo "Serial: $serial" | ||
| mformat -C -i dist/Lua160k.ima -v "$label" -f 160 -N $serial | ||
| mcopy -mi dist/Lua160k.ima $files :: | ||
| - name: Zip OS/2 Binaries | ||
| run: | | ||
| zip -j9 --DOS-names dist/bin/OS2.zip dist/bin/LUA21.EXE dist/bin/LUA22.EXE | ||
| rm dist/bin/LUA21.EXE dist/bin/LUA22.EXE | ||
| - name: Zip DOS, Linux & Windows Lua Compiler Binaries | ||
| run: | | ||
| # TODO: put Lua byte compilers on disk 2 | ||
| # zip -j9 --DOS-names dist/bin/LUAC.zip dist/bin/LUAC*.EXE | ||
| # zip -j9 -X dist/bin/LUAC.zip dist/bin/LUAC*.ELF | ||
| rm dist/bin/LUAC* | ||
| - name: Set modification time on Zip binaries to the latest commit | ||
| run: | | ||
| touch --date="$(git log -1 --pretty=format:%cI)" dist/bin/*.zip | ||
| - name: Create 1.4M Multi-Platform Floppy Diskette Image | ||
| run: | | ||
| export FAKETIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%d %H:%M:%S' --format="%cd") | ||
| export LD_PRELOAD=$(dpkg -L libfaketime | grep libfaketime.so.1) | ||
| label="LUA MULTIOS" | ||
| serial="0x$(echo "$label$FAKETIME" | sha256sum | cut -c1-8)" | ||
| files=$(find dist/bin/*.ELF dist/bin/*.EXE dist/bin/*.zip scripts/meta/floppy/1440k/1/*.LUA | sort | xargs) | ||
| echo "Faketime: $FAKETIME" | ||
| echo "Files: $files" | ||
| echo "Label: $label" | ||
| echo "Serial: $serial" | ||
| mformat -C -i dist/LuaMulti.ima -v "$label" -f 1440 -N $serial | ||
| mcopy -mi dist/LuaMulti.ima $files :: | ||
| - name: Zero-out Unallocated Clusters | ||
| run: | | ||
| lua scripts/util/FATSTAT.LUA -z dist/*ima | ||
| - name: Create Floppy Disk Images Zip | ||
| run: | | ||
| files=$(find dist/*ima | sort | xargs) | ||
| touch --date="$(git log -1 --pretty=format:%cI)" $files | ||
| zip -j9 --DOS-names dist/LuaIma.zip $files | ||
| name="dist/WLI$(sha256sum dist/LuaIma.zip | awk '{print $1}' | cut -c1-5).zip" | ||
| mv dist/LuaIma.zip $name | ||
| touch --date="$(git log -1 --pretty=format:%cI)" $name | ||
| - name: Upload Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: 'LuaDist' | ||
| path: | | ||
| dist/WLE*.zip | ||
| dist/WLI*.zip | ||
| compression-level: 0 | ||
| Draft: | ||
| name: Draft Release | ||
| needs: Watcom | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/202') | ||
| permissions: | ||
| contents: write | ||
| actions: read | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Download Artifacts | ||
| uses: actions/download-artifact@v4 | ||
| - name: Generate Release Notes | ||
| run: | | ||
| input_date="$TAG_NAME" | ||
| day=$(date -d "$input_date" '+%-d') | ||
| month=$(date -d "$input_date" '+%B') | ||
| year=$(date -d "$input_date" '+%Y') | ||
| if [[ $day -eq 11 || $day -eq 12 || $day -eq 13 ]]; then | ||
| suffix="th" | ||
| else | ||
| case $((day % 10)) in | ||
| 1) suffix="st" ;; | ||
| 2) suffix="nd" ;; | ||
| 3) suffix="rd" ;; | ||
| *) suffix="th" ;; | ||
| esac | ||
| fi | ||
| formatted_date="${day}${suffix} of ${month} ${year}" | ||
| sed -i "s/{{DATE}}/${formatted_date}/g" .github/workflows/notes.md | ||
| name="$(ls LuaDist/WLE*.zip | xargs -n 1 basename)" | ||
| sed -i "s/{{WLE}}/${name}/g" .github/workflows/notes.md | ||
| name="$(ls LuaDist/WLI*.zip | xargs -n 1 basename)" | ||
| sed -i "s/{{WLI}}/${name}/g" .github/workflows/notes.md | ||
| - name: Create Draft Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TAG_NAME="${GITHUB_REF#refs/tags/}" # Extract the tag name | ||
| gh release create "$TAG_NAME" \ | ||
| --draft \ | ||
| --title "$TAG_NAME" \ | ||
| --notes-file .github/workflows/notes.md \ | ||
| "LuaDist/*.zip" | ||