From d856bf7da7c952e8d6e98cddeac5beaea2aa6e6f Mon Sep 17 00:00:00 2001 From: Larvan2 <78135608+Larvan2@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:53:34 +0800 Subject: [PATCH] sync --- .github/workflows/build.yml | 354 +++++++++++++++---------------- scripts/Dockerfile | 2 +- scripts/build.alpine.release.sh | 9 +- scripts/build.macos.release.sh | 4 +- scripts/build.windows.release.sh | 11 +- scripts/config.termux.sh | 11 +- 6 files changed, 181 insertions(+), 210 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 032379b..0b2c140 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,9 @@ name: GitHub CI -on: [ push ] +on: + push: + branches: [ master ] + workflow_dispatch: + pull_request: concurrency: group: ${{ github.ref }}-${{ github.workflow }} @@ -21,152 +25,131 @@ jobs: name: Linux x86 Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:x86-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_linux32 - path: subconverter/ - - name: Package Release - run: tar czf subconverter_linux32.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_linux32.tar.gz - release: true - tag_name: Alpha + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:x86-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_linux32 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: tar czf subconverter_linux32.tar.gz subconverter + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_linux32.tar.gz + draft: true + tag_name: Alpha linux64_build: name: Linux x86_64 Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:amd64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_linux64 - path: subconverter/ - - name: Package Release - run: tar czf subconverter_linux64.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_linux64.tar.gz - release: true - tag_name: Alpha + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:amd64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_linux64 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: tar czf subconverter_linux64.tar.gz subconverter + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_linux64.tar.gz + draft: true + tag_name: Alpha armv7_build: name: Linux armv7 Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:armv7-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_armv7 - path: subconverter/ - - name: Package Release - run: tar czf subconverter_armv7.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_armv7.tar.gz - release: true - tag_name: Alpha - - armhf_build: - name: Linux armhf Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:armhf-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_armhf - path: subconverter/ - - name: Package Release - run: tar czf subconverter_armhf.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_armhf.tar.gz - release: true - tag_name: Alpha + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:armv7-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_armv7 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: tar czf subconverter_armv7.tar.gz subconverter + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_armv7.tar.gz + draft: true + tag_name: Alpha aarch64_build: name: Linux aarch64 Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:aarch64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_aarch64 - path: subconverter/ - - name: Package Release - run: tar czf subconverter_aarch64.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_aarch64.tar.gz - release: true - tag_name: Alpha + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:aarch64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_aarch64 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: tar czf subconverter_aarch64.tar.gz subconverter + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_aarch64.tar.gz + draft: true + tag_name: Alpha macos_build: name: macOS Build runs-on: macos-latest steps: - - uses: actions/checkout@v2 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i -e 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: bash scripts/build.macos.release.sh - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_darwin64 - path: subconverter/ - - name: Package Release - run: tar czf subconverter_darwin64.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_darwin64.tar.gz - release: true - tag_name: Alpha - + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i -e 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: bash scripts/build.macos.release.sh + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_darwin64 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: tar czf subconverter_darwin64.tar.gz subconverter + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_darwin64.tar.gz + draft: true + tag_name: Alpha windows64_build: name: Windows x86_64 Build @@ -175,34 +158,36 @@ jobs: run: shell: msys2 {0} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta - with: - node-version: '16' - - uses: msys2/setup-msys2@v2 - with: - update: true - install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 patch - msystem: MINGW64 - path-type: inherit - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: bash scripts/build.windows.release.sh - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_win64 - path: subconverter/ - - name: Package Release - run: 7z a subconverter_win64.7z subconverter/ - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_win64.7z - release: true - tag_name: Alpha + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - uses: msys2/setup-msys2@v2 + with: + update: true + install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 patch + msystem: MINGW64 + path-type: inherit + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: bash scripts/build.windows.release.sh + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_win64 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: 7z a subconverter_win64.7z subconverter/ + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_win64.7z + draft: true + tag_name: Alpha windows32_build: name: Windows x86 Build @@ -211,32 +196,33 @@ jobs: run: shell: msys2 {0} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta - with: - node-version: '16' - - uses: msys2/setup-msys2@v2 - with: - update: true - install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-libevent mingw-w64-i686-pcre2 patch - msystem: MINGW32 - path-type: inherit - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: bash scripts/build.windows.release.sh - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: subconverter_win32 - path: subconverter/ - - name: Package Release - run: 7z a subconverter_win32.7z subconverter/ - - name: Draft Release - uses: softprops/action-gh-release@v1 - with: - files: subconverter_win32.7z - release: true - tag_name: Alpha - + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - uses: msys2/setup-msys2@v2 + with: + update: true + install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-libevent mingw-w64-i686-pcre2 patch + msystem: MINGW32 + path-type: inherit + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: bash scripts/build.windows.release.sh + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: subconverter_win32 + path: subconverter/ + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: 7z a subconverter_win32.7z subconverter/ + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_win32.7z + draft: true + tag_name: Alpha diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 3443b1d..66e54ce 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -30,7 +30,7 @@ RUN apk add --no-cache --virtual .build-tools git g++ build-base linux-headers c cd .. && \ git clone https://github.com/ToruNiina/toml11 --depth=1 && \ cd toml11 && \ - cmake . && \ + cmake -DCMAKE_CXX_STANDARD=11 . && \ make install -j $THREADS && \ cd .. && \ git clone https://github.com/tindy2013/subconverter --depth=1 && \ diff --git a/scripts/build.alpine.release.sh b/scripts/build.alpine.release.sh index b74637a..ed47ee4 100644 --- a/scripts/build.alpine.release.sh +++ b/scripts/build.alpine.release.sh @@ -30,17 +30,12 @@ git clone https://github.com/PerMalmberg/libcron --depth=1 cd libcron git submodule update --init cmake -DCMAKE_BUILD_TYPE=Release . -make libcron -j2 -install -m644 libcron/out/Release/liblibcron.a /usr/lib/ -install -d /usr/include/libcron/ -install -m644 libcron/include/libcron/* /usr/include/libcron/ -install -d /usr/include/date/ -install -m644 libcron/externals/date/include/date/* /usr/include/date/ +make libcron install -j2 cd .. git clone https://github.com/ToruNiina/toml11 --depth=1 cd toml11 -cmake -DCMAKE_CXX_STANDARD=17 . +cmake -DCMAKE_CXX_STANDARD=11 . make install -j4 cd .. diff --git a/scripts/build.macos.release.sh b/scripts/build.macos.release.sh index d7c3904..1764639 100644 --- a/scripts/build.macos.release.sh +++ b/scripts/build.macos.release.sh @@ -31,7 +31,7 @@ git clone https://github.com/PerMalmberg/libcron --depth=1 cd libcron git submodule update --init cmake -DCMAKE_BUILD_TYPE=Release . -make libcron -j8 +make libcron install -j8 install -m644 libcron/out/Release/liblibcron.a /usr/local/lib/ install -d /usr/local/include/libcron/ install -m644 libcron/include/libcron/* /usr/local/include/libcron/ @@ -41,7 +41,7 @@ cd .. git clone https://github.com/ToruNiina/toml11 --depth=1 cd toml11 -cmake -DCMAKE_CXX_STANDARD=17 . +cmake -DCMAKE_CXX_STANDARD=11 . make install -j4 cd .. diff --git a/scripts/build.windows.release.sh b/scripts/build.windows.release.sh index 2d012dc..3de242c 100644 --- a/scripts/build.windows.release.sh +++ b/scripts/build.windows.release.sh @@ -27,13 +27,8 @@ cd .. git clone https://github.com/PerMalmberg/libcron --depth=1 cd libcron git submodule update --init -cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release . -make libcron -j4 -install -m644 libcron/out/Release/liblibcron.a "$MINGW_PREFIX/lib/" -install -d "$MINGW_PREFIX/include/libcron/" -install -m644 libcron/include/libcron/* "$MINGW_PREFIX/include/libcron/" -install -d "$MINGW_PREFIX/include/date/" -install -m644 libcron/externals/date/include/date/* "$MINGW_PREFIX/include/date/" +cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" . +make libcron install -j4 cd .. git clone https://github.com/Tencent/rapidjson --depth=1 @@ -44,7 +39,7 @@ cd .. git clone https://github.com/ToruNiina/toml11 --depth=1 cd toml11 -cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" . +cmake -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=11 . make install -j4 cd .. diff --git a/scripts/config.termux.sh b/scripts/config.termux.sh index 12b03ce..ba15153 100644 --- a/scripts/config.termux.sh +++ b/scripts/config.termux.sh @@ -29,17 +29,12 @@ cd .. git clone https://github.com/PerMalmberg/libcron --depth=1 cd libcron git submodule update --init -cmake -DCMAKE_BUILD_TYPE=Release . -make libcron -j3 -install -m644 libcron/out/Release/liblibcron.a $PREFIX/lib/ -install -d $PREFIX/include/libcron/ -install -m644 libcron/include/libcron/* $PREFIX/include/libcron/ -install -d $PREFIX/include/date/ -install -m644 libcron/externals/date/include/date/* $PREFIX/include/date/ +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX . +make libcron install -j3 cd .. git clone https://github.com/ToruNiina/toml11 --depth=1 cd toml11 -cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=$PREFIX . +cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_CXX_STANDARD=11 . make install -j3 cd ..