CadZinho CI #98
Workflow file for this run
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: CadZinho CI | |
on: workflow_dispatch | |
env: | |
MAJOR: 0 | |
MINOR: 6 | |
MAN: 0 | |
YEAR: 2024 | |
LUA_V: 5.4.6 | |
MESA_V: 23.1.1 | |
GLEW_V: 2.2.0 | |
SDL_V: 2.30.0 | |
SDL_NET_V: 2.2.0 | |
jobs: | |
up-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Update version in information files | |
run: | | |
sed -i -e "/CZ_VERSION/s/[[:digit:]]\{4\}/$YEAR/" \ | |
-e "/CZ_VERSION/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/$MAJOR.\2.\3/" \ | |
-e "/CZ_VERSION/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.$MINOR.\3/" \ | |
-e "/CZ_VERSION/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.\2.$MAN/" \ | |
./src/dxf.h | |
sed -i -e "/Comments/s/[[:digit:]]\{4\}/$YEAR/" \ | |
-e "/FILEVERSION/s/\([[:digit:]]\+\),\([[:digit:]]\+\),\([[:digit:]]\+\),0/$MAJOR,\2,\3,0/" \ | |
-e "/FILEVERSION/s/\([[:digit:]]\+\),\([[:digit:]]\+\),\([[:digit:]]\+\),0/\1,$MINOR,\3,0/" \ | |
-e "/FILEVERSION/s/\([[:digit:]]\+\),\([[:digit:]]\+\),\([[:digit:]]\+\),0/\1,\2,$MAN,0/" \ | |
-e "/PRODUCTVERSION/s/\([[:digit:]]\+\),\([[:digit:]]\+\),\([[:digit:]]\+\),0/$MAJOR,\2,\3,0/" \ | |
-e "/PRODUCTVERSION/s/\([[:digit:]]\+\),\([[:digit:]]\+\),\([[:digit:]]\+\),0/\1,$MINOR,\3,0/" \ | |
-e "/PRODUCTVERSION/s/\([[:digit:]]\+\),\([[:digit:]]\+\),\([[:digit:]]\+\),0/\1,\2,$MAN,0/" \ | |
-e "/LegalCopyright/s/[[:digit:]]\{4\}/$YEAR/" \ | |
-e "/FileVersion/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/$MAJOR.\2.\3/" \ | |
-e "/FileVersion/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.$MINOR.\3/" \ | |
-e "/FileVersion/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.\2.$MAN/" \ | |
-e "/ProductVersion/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/$MAJOR.\2.\3/" \ | |
-e "/ProductVersion/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.$MINOR.\3/" \ | |
-e "/ProductVersion/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.\2.$MAN/" \ | |
./windows/cz.rc | |
sed -i -e "/Version/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/$MAJOR.\2.\3/" \ | |
-e "/Version/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.$MINOR.\3/" \ | |
-e "/Version/s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.\2.$MAN/" \ | |
-e "/Comments/s/[[:digit:]]\{4\}/$YEAR/" \ | |
./windows/cadzinho.wxs | |
sed -i -e "/NSHumanReadableCopyright/,+1s/[[:digit:]]\{4\}/$YEAR/" \ | |
-e "/CFBundleShortVersionString/,+1s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/$MAJOR.\2.\3/" \ | |
-e "/CFBundleShortVersionString/,+1s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.$MINOR.\3/" \ | |
-e "/CFBundleShortVersionString/,+1s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.\2.$MAN/" \ | |
-e "/CFBundleVersion/,+1s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/$MAJOR.\2.\3/" \ | |
-e "/CFBundleVersion/,+1s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.$MINOR.\3/" \ | |
-e "/CFBundleVersion/,+1s/\([[:digit:]]\+\).\([[:digit:]]\+\).\([[:digit:]]\+\)/\1.\2.$MAN/" \ | |
./macos/CadZinho.app/Contents/Info.plist | |
- name: Commit | |
run: | | |
git config --global user.name 'zecruel' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "Update version to $MAJOR.$MINOR.$MAN - $YEAR" | |
git push | |
continue-on-error: true | |
linux-build: | |
needs: up-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: configure | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes libsdl2-dev libsdl2-net-dev libglvnd-dev libglew-dev fuse libfuse2 libarchive-tools | |
sudo gem install fpm | |
- name: download lua source | |
uses: suisei-cn/[email protected] | |
with: | |
url: "http://www.lua.org/ftp/lua-${{ env.LUA_V }}.tar.gz" | |
target: . | |
- name: extract lua | |
run: tar zxf lua-${{ env.LUA_V }}.tar.gz | |
- name: remove main in lua | |
run: rm lua-${{ env.LUA_V }}/src/lua.c lua-${{ env.LUA_V }}/src/luac.c | |
- name: copy lua sources | |
run: cp lua-${{ env.LUA_V }}/src/* ./src/ | |
- name: get make file | |
run: cp linux/Makefile ./Makefile | |
- name: make | |
run: make | |
- name: configure for fpm | |
run: | | |
mkdir pkg | |
mkdir pkg/usr | |
mkdir pkg/usr/bin | |
cp ./cadzinho ./pkg/usr/bin/ | |
cp -r ./linux/CadZinho/share/ ./pkg/usr/ | |
mkdir pkg/usr/share/cadzinho | |
cp ./LICENSE.txt ./pkg/usr/share/cadzinho/ | |
cp -r ./lang/ ./pkg/usr/share/cadzinho/ | |
- name: Debian linux package | |
run: | | |
cd ./pkg | |
fpm -s dir -t deb \ | |
--name cadzinho \ | |
--license MIT \ | |
--version $MAJOR.$MINOR.$MAN \ | |
--architecture native \ | |
--depends sdl2 --depends glew --depends sdl2-net \ | |
--description "CadZinho - Minimalist computer aided design (CAD) software" \ | |
--url "https://github.com/zecruel/CadZinho" \ | |
--maintainer "Ezequiel Rabelo de Aguiar <[email protected]>" ./ | |
cd .. | |
mv ./pkg/*.deb ./ | |
dpkg -c cadzinho_${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}_amd64.deb | |
- name: RedHat linux package | |
run: | | |
cd ./pkg | |
fpm -s dir -t rpm \ | |
--name cadzinho \ | |
--license MIT \ | |
--version $MAJOR.$MINOR.$MAN \ | |
--architecture native \ | |
--depends sdl2 --depends glew --depends sdl2_net \ | |
--description "CadZinho - Minimalist computer aided design (CAD) software" \ | |
--url "https://github.com/zecruel/CadZinho" \ | |
--maintainer "Ezequiel Rabelo de Aguiar <[email protected]>" ./ | |
cd .. | |
mv ./pkg/*.rpm ./ | |
- name: Arch linux package | |
run: | | |
cd ./pkg | |
fpm -s dir -t pacman \ | |
--name cadzinho \ | |
--license MIT \ | |
--version $MAJOR.$MINOR.$MAN \ | |
--architecture native \ | |
--depends sdl2 --depends glew --depends sdl2_net \ | |
--description "CadZinho - Minimalist computer aided design (CAD) software" \ | |
--url "https://github.com/zecruel/CadZinho" \ | |
--maintainer "Ezequiel Rabelo de Aguiar <[email protected]>" ./ | |
cd .. | |
mv ./pkg/*.zst ./ | |
- name: download AppImageTool | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" | |
target: . | |
- name: download AppImage asset | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64" | |
target: . | |
- name: configure AppImageKit | |
run: | | |
mkdir CadZinho.AppDir | |
mkdir CadZinho.AppDir/usr/ | |
mkdir CadZinho.AppDir/usr/lib | |
mkdir CadZinho.AppDir/usr/bin | |
mkdir CadZinho.AppDir/usr/share | |
mkdir CadZinho.AppDir/usr/share/cadzinho | |
mv AppRun-x86_64 CadZinho.AppDir/AppRun | |
chmod u+x ./CadZinho.AppDir/AppRun | |
cp ./linux/cadzinho.desktop ./CadZinho.AppDir | |
cp ./linux/cadzinho.png ./CadZinho.AppDir | |
cp ./cadzinho ./CadZinho.AppDir/usr/bin | |
cp -r ./lang/ ./CadZinho.AppDir/usr/share/cadzinho/ | |
cp $(ldd cadzinho | grep -o '\W/[^ ]*' | grep 'SDL2\|GLEW\|decor') ./CadZinho.AppDir/usr/lib | |
chmod u+x ./appimagetool-x86_64.AppImage | |
./appimagetool-x86_64.AppImage CadZinho.AppDir | |
- name: create archive | |
run: | | |
zip -r linux_appimage CadZinho-x86_64.AppImage LICENSE.txt | |
- name: regular linux package | |
run: | | |
mkdir ./linux/CadZinho/share/cadzinho | |
cp ./cadzinho ./linux/CadZinho | |
cp ./LICENSE.txt ./linux/CadZinho/share/cadzinho | |
cp -r ./lang/ ./linux/CadZinho/share/cadzinho/ | |
cd ./linux/CadZinho | |
zip -r linux * | |
- run: cp ./linux/CadZinho/linux.zip ./ | |
- name: Upload the result | |
uses: actions/[email protected] | |
with: | |
name: linux | |
path: | | |
linux_appimage.zip | |
linux.zip | |
cadzinho-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}-1-x86_64.pkg.tar.zst | |
cadzinho_${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}_amd64.deb | |
cadzinho-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}-1.x86_64.rpm | |
retention-days: 5 | |
macos-build: | |
needs: up-version | |
runs-on: macos-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: configure | |
run: brew install sdl2 sdl2_net lua mesa-glu glew dylibbundler | |
- name: download lua source | |
uses: suisei-cn/[email protected] | |
with: | |
url: "http://www.lua.org/ftp/lua-${{ env.LUA_V }}.tar.gz" | |
target: . | |
- name: extract lua | |
run: tar zxf lua-${{ env.LUA_V }}.tar.gz | |
- name: remove main in lua | |
run: rm lua-${{ env.LUA_V }}/src/lua.c lua-${{ env.LUA_V }}/src/luac.c | |
- name: copy lua sources | |
run: cp lua-${{ env.LUA_V }}/src/* ./src/ | |
- name: get make file | |
run: cp macos/Makefile ./Makefile | |
- name: make | |
run: make | |
- run: mkdir ./macos/CadZinho.app/Contents/MacOS | |
- run: cp ./cadzinho ./macos/CadZinho.app/Contents/MacOS/cadzinho | |
- run: cp -r ./lang/ ./macos/CadZinho.app/Contents/Resources/lang/ | |
- name: fix dependencies | |
run: dylibbundler -od -b -x ./macos/CadZinho.app/Contents/MacOS/cadzinho -d ./macos/CadZinho.app/Contents/libs/ | |
- name: create archive | |
run: | | |
cp LICENSE macos | |
cd macos | |
zip -r macos ./CadZinho.app/ LICENSE.txt | |
- name: Upload the result | |
uses: actions/[email protected] | |
with: | |
name: macos | |
path: macos/macos.zip | |
retention-days: 5 | |
windows-build: | |
needs: up-version | |
defaults: | |
run: | |
shell: msys2 {0} | |
runs-on: windows-latest | |
steps: | |
- name: Setup MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: >- | |
base-devel | |
git | |
gcc | |
make | |
p7zip | |
mingw-w64-x86_64-toolchain | |
mingw64/mingw-w64-x86_64-SDL2 | |
mingw64/mingw-w64-x86_64-SDL2_net | |
mingw64/mingw-w64-x86_64-glew | |
- uses: actions/[email protected] | |
- name: download lua source | |
uses: suisei-cn/[email protected] | |
with: | |
url: "http://www.lua.org/ftp/lua-${{ env.LUA_V }}.tar.gz" | |
target: . | |
- name: extract lua | |
run: tar zxf lua-${{ env.LUA_V }}.tar.gz | |
- name: remove main in lua | |
shell: cmd | |
run: | | |
cd lua-${{ env.LUA_V }}\src | |
del lua.c | |
del luac.c | |
- name: copy lua sources | |
run: cp ./lua-${{ env.LUA_V }}/src/* ./src/ | |
- name: get make file and resources | |
run: cp windows/* ./ | |
- name: make | |
run: make | |
- name: download mesa3d | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/pal1000/mesa-dist-win/releases/download/${{ env.MESA_V }}/mesa3d-${{ env.MESA_V }}-release-mingw.7z" | |
target: . | |
- name: Unzip mesa3d | |
shell: cmd | |
run: | | |
7z x -y mesa3d-${{ env.MESA_V }}-release-mingw.7z | |
ls | |
- run: | | |
mkdir CadZinho | |
cp cadzinho.exe CadZinho/ | |
cp -r ./lang/ CadZinho/ | |
cp windows/cadzinho.ico CadZinho/ | |
cp /mingw64/bin/SDL2.dll CadZinho/ | |
cp /mingw64/bin/SDL2_net.dll CadZinho/ | |
cp /mingw64/bin/glew32.dll CadZinho/ | |
cp x64/opengl32.dll CadZinho/ | |
cp x64/libgallium_wgl.dll CadZinho/ | |
cp x64/libglapi.dll CadZinho/ | |
cp x64/dxil.dll CadZinho/ | |
cp LICENSE.txt CadZinho/ | |
- name: create archive | |
run: 7z a windows.zip CadZinho | |
- name: Upload the result | |
uses: actions/[email protected] | |
with: | |
name: windows | |
path: windows.zip | |
retention-days: 5 | |
msvc-build: | |
needs: up-version | |
runs-on: windows-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: download lua source | |
uses: suisei-cn/[email protected] | |
with: | |
url: "http://www.lua.org/ftp/lua-${{ env.LUA_V }}.tar.gz" | |
target: . | |
- name: extract lua | |
run: tar zxf lua-${{ env.LUA_V }}.tar.gz | |
- name: remove main in lua | |
shell: cmd | |
run: | | |
cd lua-${{ env.LUA_V }}\src | |
del lua.c | |
del luac.c | |
- name: copy lua sources | |
run: cp ./lua-${{ env.LUA_V }}/src/* ./src/ | |
- name: download glew | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/nigels-com/glew/releases/download/glew-${{ env.GLEW_V }}/glew-${{ env.GLEW_V }}-win32.zip" | |
target: . | |
- name: Unzip glew | |
shell: cmd | |
run: | | |
7z x -y glew-${{ env.GLEW_V }}-win32.zip | |
- name: Download SDL2 | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/libsdl-org/SDL/releases/download/release-${{ env.SDL_V }}/SDL2-devel-${{ env.SDL_V }}-VC.zip" | |
target: . | |
- name: Download SDL2_net | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/libsdl-org/SDL_net/releases/download/release-${{ env.SDL_NET_V }}/SDL2_net-devel-${{ env.SDL_NET_V }}-VC.zip" | |
target: . | |
- name: Unzip SDL2 | |
shell: cmd | |
run: | | |
7z x -y SDL2-devel-${{ env.SDL_V }}-VC.zip | |
- name: Unzip SDL2_net | |
shell: cmd | |
run: | | |
7z x -y SDL2_net-devel-${{ env.SDL_NET_V }}-VC.zip | |
- name: download mesa3d | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/pal1000/mesa-dist-win/releases/download/${{ env.MESA_V }}/mesa3d-${{ env.MESA_V }}-release-msvc.7z" | |
target: . | |
- name: Unzip mesa3d | |
shell: cmd | |
run: | | |
7z x -y mesa3d-${{ env.MESA_V }}-release-msvc.7z | |
ls | |
- run: | | |
mkdir ./glew-${{ env.GLEW_V }}/include/SDL2 | |
mkdir ./CadZinho | |
cp ./SDL2-${{ env.SDL_V }}/include/* ./glew-${{ env.GLEW_V }}/include/SDL2/ | |
mv ./SDL2-${{ env.SDL_V }} ./SDL2 | |
cp ./SDL2_net-${{ env.SDL_NET_V }}/include/* ./src/ | |
cp ./SDL2_net-${{ env.SDL_NET_V }}/include/* ./SDL2/include/ | |
cp ./SDL2_net-${{ env.SDL_NET_V }}/include/* ./glew-${{ env.GLEW_V }}/include/SDL2/ | |
cp ./SDL2_net-${{ env.SDL_NET_V }}/lib/x64/* ./SDL2/ | |
mv ./SDL2_net-${{ env.SDL_NET_V }}/lib ./lib | |
mv ./glew-${{ env.GLEW_V }} ./glew | |
ls -R ./ | |
- name: get make file and resources | |
run: cp windows/* ./ | |
- uses: ilammy/[email protected] | |
- name: Build using CL.EXE | |
run: nmake WIN64=1 -f Makefile.msvc | |
- run: | | |
cp windows/cadzinho.ico CadZinho/ | |
cp ./SDL2/lib/x64/SDL2.dll CadZinho/ | |
cp ./lib/x64/SDL2_net.dll CadZinho/ | |
cp ./glew/bin/Release/x64/glew32.dll CadZinho/ | |
cp ./cadzinho.exe CadZinho/ | |
cp -r ./lang/ CadZinho/ | |
cp x64/opengl32.dll CadZinho/ | |
cp x64/libgallium_wgl.dll CadZinho/ | |
cp x64/libglapi.dll CadZinho/ | |
cp x64/dxil.dll CadZinho/ | |
cp LICENSE.txt CadZinho/ | |
- name: create archive | |
run: 7z a windows_msvc.zip CadZinho | |
- name: download wix3 | |
uses: suisei-cn/[email protected] | |
with: | |
url: "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip" | |
target: . | |
- name: Unzip wix3 | |
shell: cmd | |
run: | | |
7z x -y wix311-binaries.zip | |
ls | |
- name: create MSI installer | |
run: | | |
cp cadzinho.wxs CadZinho/ | |
cd CadZinho | |
../candle.exe cadzinho.wxs | |
../light.exe cadzinho.wixobj | |
mv cadzinho.msi ../ | |
- name: Upload the result | |
uses: actions/[email protected] | |
with: | |
name: msvc | |
path: | | |
windows_msvc.zip | |
cadzinho.msi | |
retention-days: 5 | |
emscripten-built: | |
needs: up-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: configure SDK | |
uses: mymindstorm/setup-emsdk@v14 | |
- name: download lua source | |
uses: suisei-cn/[email protected] | |
with: | |
url: "http://www.lua.org/ftp/lua-${{ env.LUA_V }}.tar.gz" | |
target: . | |
- name: extract lua | |
run: tar zxf lua-${{ env.LUA_V }}.tar.gz | |
- name: remove main in lua | |
run: rm lua-${{ env.LUA_V }}/src/lua.c lua-${{ env.LUA_V }}/src/luac.c | |
- name: copy lua sources | |
run: cp lua-${{ env.LUA_V }}/src/* ./src/ | |
- name: clear samples | |
run: | | |
rm samples/*.pdf | |
rm samples/*.svg | |
rm samples/*.ps | |
rm samples/*.jpg | |
- name: get make and resources files | |
run: | | |
cp emscripten/Makefile ./Makefile | |
cp emscripten/shell_minimal.html ./shell_minimal.html | |
- name: make | |
run: make | |
- name: create archive | |
run: | | |
zip -r emscripten cadzinho.js cadzinho.wasm cadzinho.html cadzinho.data | |
- name: Upload the result | |
uses: actions/[email protected] | |
with: | |
name: emscripten | |
path: emscripten.zip | |
retention-days: 5 | |
release: | |
needs: [linux-build, macos-build, windows-build, msvc-build, emscripten-built] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
- uses: softprops/[email protected] | |
with: | |
tag_name: ${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }} | |
draft: true | |
files: | | |
linux/linux.zip | |
linux/linux_appimage.zip | |
macos/macos.zip | |
windows/windows.zip | |
msvc/windows_msvc.zip | |
msvc/cadzinho.msi | |
emscripten/emscripten.zip | |
linux/cadzinho-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}-1-x86_64.pkg.tar.zst | |
linux/cadzinho_${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}_amd64.deb | |
linux/cadzinho-${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.MAN }}-1.x86_64.rpm | |