Merge pull request #5 from gretmn102/master #26
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: CI | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| pull_request: | |
| env: | |
| luajit_ver: 2.0.5 | |
| iconv_ver: 1.16 | |
| jobs: | |
| build: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Cache libs | |
| id: cache-libs | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| libs | |
| winlibs | |
| key: ${{ runner.os }}-${{ env.luajit_ver }}-${{ env.iconv_ver }} | |
| - name: Install Packages | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y gcc-mingw-w64-i686 mingw-w64-i686-dev binutils-mingw-w64-i686 gcc-multilib git | |
| sudo apt-get install -y build-essential | |
| - name: Prep | |
| run: | | |
| git submodule init | |
| git submodule update | |
| - if: ${{ steps.cache-libs.outputs.cache-hit != 'true' }} | |
| name: luajit | |
| run: | | |
| mkdir libs winlibs | |
| git clone https://luajit.org/git/luajit.git | |
| cd luajit | |
| git switch --detach tags/v${{ env.luajit_ver }} | |
| make CROSS=i686-w64-mingw32- HOST_CC="gcc -m32" TARGET_SYS=Windows BUILDMODE=static | |
| for f in lua.h luaconf.h lualib.h lauxlib.h; do | |
| cp src/$f ../winlibs/ | |
| done | |
| cp src/libluajit.a ../winlibs/ | |
| make clean | |
| make DEFAULT_CC="gcc" BUILDMODE=static V=1 | |
| cp src/libluajit.a ../libs/ | |
| for f in lua.h luaconf.h lualib.h lauxlib.h; do | |
| cp src/$f ../libs/ | |
| done | |
| - if: ${{ steps.cache-libs.outputs.cache-hit != 'true' }} | |
| name: libiconv | |
| run: | | |
| wget https://ftp.gnu.org/gnu/libiconv/libiconv-${{ env.iconv_ver }}.tar.gz | |
| tar xvf libiconv-${{ env.iconv_ver }}.tar.gz | |
| cd libiconv-${{ env.iconv_ver }} | |
| ./configure --prefix=/usr/local --disable-shared --enable-static --host=i686-w64-mingw32 | |
| make | |
| cp lib/.libs/*.a ../winlibs | |
| cp include/*.h ../winlibs | |
| cd .. | |
| rm -rf libiconv-${{ env.iconv_ver }} && tar xvf libiconv-${{ env.iconv_ver }}.tar.gz | |
| cd libiconv-${{ env.iconv_ver }} | |
| CC=gcc ./configure --prefix=/usr/local --disable-shared --enable-static | |
| make | |
| cp lib/.libs/*.a ../libs | |
| cp include/*.h ../libs | |
| - name: Build windows binary | |
| run: | | |
| make -f Makefile.mingw LUA_CFLAGS="" LUA_LFLAGS="" EXTRA_CFLAGS="-static -L./winlibs/ -I./winlibs/" EXTRA_LDFLAGS="-lluajit" VERSION=`date +%y%m%d` install | |
| make -f Makefile.mingw clean | |
| - name: Build linux binary | |
| run: | | |
| make EXTRA_CFLAGS="-static -L./libs/ -I./libs/" EXTRA_LDFLAGS="libs/libluajit.a libs/libiconv.a -ldl -lm" VERSION=`date +%y%m%d` install | |
| make clean | |
| - name: Create Artifact | |
| run: | | |
| mkdir -p artifact/instead-cli | |
| cp -r release/* artifact/instead-cli | |
| cp README.md artifact/instead-cli/ | |
| strip artifact/instead-cli/instead-cli | |
| - name: Publish Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: instead-cli | |
| path: artifact | |
| retention-days: 1 | |
| upload: | |
| name: Create release and upload artifacts | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v2 | |
| - name: Create zip | |
| run: | | |
| ls -alFR | |
| cd instead-cli | |
| chmod +x instead-cli/instead-cli | |
| zip -r ../instead-cli.zip instead-cli/ | |
| - name: Create release and upload artifacts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| sudo apt-get install -y libfuse2 | |
| wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage | |
| chmod +x pyuploadtool-x86_64.AppImage | |
| ./pyuploadtool-x86_64.AppImage instead-cli.zip |