ci(docker): refresh source dependencies from dev builds

This commit is contained in:
Aethersailor
2026-05-19 23:36:45 +08:00
parent 36c83c3e12
commit 1557bddc57
5 changed files with 53 additions and 44 deletions

View File

@@ -144,6 +144,7 @@ jobs:
BUILD_DATE=${{ needs.prepare.outputs.build_date }}
MIHOMO_REF=Meta
MIHOMO_CACHE_BUST=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' && github.run_id || 'stable' }}
SOURCE_DEPS_CACHE_BUST=${{ github.event_name != 'pull_request' && github.run_id || 'stable' }}
REFRESH_GO_DEPS=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
REFRESH_HEADERS=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
cache-from: type=gha,scope=subconverter-alpine
@@ -169,6 +170,11 @@ jobs:
docker cp $CONTAINER_ID:/src/include/inja.hpp include/inja.hpp
docker cp $CONTAINER_ID:/src/include/jpcre2.hpp include/jpcre2.hpp
docker cp $CONTAINER_ID:/src/include/quickjspp.hpp include/quickjspp.hpp
rm -rf include/libcron include/date include/toml11 include/toml.hpp
docker cp $CONTAINER_ID:/src/include/libcron include/
docker cp $CONTAINER_ID:/src/include/date include/
docker cp $CONTAINER_ID:/src/include/toml.hpp include/toml.hpp
docker cp $CONTAINER_ID:/src/include/toml11 include/
# [NEW] Extract Binary for Release (if needed)
if [ "${{ needs.prepare.outputs.is_release }}" == "true" ]; then
@@ -239,7 +245,7 @@ jobs:
- name: Check for file changes
id: check_changes
run: |
if [ -n "$(git status --porcelain -- bridge/go.mod bridge/go.sum bridge/libmihomo.h src/parser/mihomo_schemes.h src/parser/param_compat.h include/httplib.h include/nlohmann/json.hpp include/inja.hpp include/jpcre2.hpp include/quickjspp.hpp)" ]; then
if [ -n "$(git status --porcelain -- bridge/go.mod bridge/go.sum bridge/libmihomo.h src/parser/mihomo_schemes.h src/parser/param_compat.h include/httplib.h include/nlohmann/json.hpp include/inja.hpp include/jpcre2.hpp include/quickjspp.hpp include/libcron include/date include/toml.hpp include/toml11)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
@@ -251,7 +257,7 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add bridge/go.mod bridge/go.sum bridge/libmihomo.h src/parser/mihomo_schemes.h src/parser/param_compat.h include/httplib.h include/nlohmann/json.hpp include/inja.hpp include/jpcre2.hpp include/quickjspp.hpp
git add bridge/go.mod bridge/go.sum bridge/libmihomo.h src/parser/mihomo_schemes.h src/parser/param_compat.h include/httplib.h include/nlohmann/json.hpp include/inja.hpp include/jpcre2.hpp include/quickjspp.hpp include/libcron include/date include/toml.hpp include/toml11
git commit -m "chore: update auto-generated files and header libraries from build [skip ci]"
git fetch --no-tags origin "refs/heads/$BRANCH_NAME:refs/remotes/origin/$BRANCH_NAME"
@@ -279,6 +285,7 @@ jobs:
BUILD_DATE=${{ needs.prepare.outputs.build_date }}
MIHOMO_REF=Meta
MIHOMO_CACHE_BUST=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' && github.run_id || 'stable' }}
SOURCE_DEPS_CACHE_BUST=${{ github.event_name != 'pull_request' && github.run_id || 'stable' }}
REFRESH_GO_DEPS=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
REFRESH_HEADERS=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
cache-from: type=gha,scope=subconverter-alpine
@@ -341,6 +348,7 @@ jobs:
BUILD_DATE=${{ needs.prepare.outputs.build_date }}
MIHOMO_REF=Meta
MIHOMO_CACHE_BUST=stable
SOURCE_DEPS_CACHE_BUST=${{ github.event_name != 'pull_request' && github.run_id || 'stable' }}
REFRESH_GO_DEPS=false
REFRESH_HEADERS=false
cache-from: type=gha,scope=subconverter-alpine-arm64
@@ -422,6 +430,7 @@ jobs:
BUILD_DATE=${{ needs.prepare.outputs.build_date }}
MIHOMO_REF=Meta
MIHOMO_CACHE_BUST=stable
SOURCE_DEPS_CACHE_BUST=${{ github.event_name != 'pull_request' && github.run_id || 'stable' }}
REFRESH_GO_DEPS=false
REFRESH_HEADERS=false
cache-from: type=gha,scope=subconverter-alpine-arm64
@@ -484,6 +493,7 @@ jobs:
BUILD_DATE=${{ needs.prepare.outputs.build_date }}
MIHOMO_REF=Meta
MIHOMO_CACHE_BUST=stable
SOURCE_DEPS_CACHE_BUST=${{ github.event_name != 'pull_request' && github.run_id || 'stable' }}
REFRESH_GO_DEPS=false
REFRESH_HEADERS=false
cache-from: type=gha,scope=subconverter-armv7-cross

View File

@@ -58,9 +58,7 @@ ARG SHA=""
ARG VERSION="dev"
ARG BUILD_DATE=""
ARG REFRESH_HEADERS=false
ARG QUICKJSPP_REF="01cdd3047ced48265b127790848a0ca88204f2c7"
ARG LIBCRON_REF="v1.3.3"
ARG TOML11_REF="v4.4.0"
ARG SOURCE_DEPS_CACHE_BUST=stable
WORKDIR /
@@ -75,12 +73,9 @@ RUN apt-get update && \
# quickjspp
RUN set -xe && \
git init quickjspp && \
echo "SOURCE_DEPS_CACHE_BUST=${SOURCE_DEPS_CACHE_BUST}" && \
git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/ftk/quickjspp.git quickjspp && \
cd quickjspp && \
git remote add origin https://github.com/ftk/quickjspp.git && \
git fetch --depth=1 origin "${QUICKJSPP_REF}" && \
git checkout --detach FETCH_HEAD && \
git submodule update --init && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make quickjs -j ${THREADS} && \
install -d /usr/lib/quickjs/ && \
@@ -91,12 +86,9 @@ RUN set -xe && \
# libcron
RUN set -xe && \
git init libcron && \
echo "SOURCE_DEPS_CACHE_BUST=${SOURCE_DEPS_CACHE_BUST}" && \
git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/PerMalmberg/libcron.git libcron && \
cd libcron && \
git remote add origin https://github.com/PerMalmberg/libcron && \
git fetch --depth=1 origin "${LIBCRON_REF}" && \
git checkout --detach FETCH_HEAD && \
git submodule update --init && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make libcron -j ${THREADS} && \
install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
@@ -106,11 +98,9 @@ RUN set -xe && \
install -m644 libcron/externals/date/include/date/* /usr/include/date/
RUN set -xe && \
git init toml11 && \
echo "SOURCE_DEPS_CACHE_BUST=${SOURCE_DEPS_CACHE_BUST}" && \
git clone --depth=1 https://github.com/ToruNiina/toml11.git toml11 && \
cd toml11 && \
git remote add origin https://github.com/ToruNiina/toml11 && \
git fetch --depth=1 origin "${TOML11_REF}" && \
git checkout --detach FETCH_HEAD && \
cmake -DCMAKE_CXX_STANDARD=11 . && \
make install -j ${THREADS}
@@ -136,10 +126,18 @@ RUN set -xe && \
curl -fsSL https://raw.githubusercontent.com/pantor/inja/master/single_include/inja/inja.hpp -o include/inja.hpp && \
echo "Downloading latest jpcre2..." && \
curl -fsSL https://raw.githubusercontent.com/jpcre2/jpcre2/master/src/jpcre2.hpp -o include/jpcre2.hpp && \
echo "Copying pinned quickjspp from compiled source..." && \
cp /usr/include/quickjspp.hpp include/quickjspp.hpp; \
echo "Copying latest quickjspp from compiled source..." && \
cp /usr/include/quickjspp.hpp include/quickjspp.hpp && \
echo "Copying latest libcron headers from compiled source..." && \
rm -rf include/libcron include/date && \
cp -a /libcron/libcron/include/libcron include/libcron && \
cp -a /libcron/libcron/externals/date/include/date include/date && \
echo "Copying latest toml11 headers from compiled source..." && \
rm -rf include/toml11 && \
cp /toml11/include/toml.hpp include/toml.hpp && \
cp -a /toml11/include/toml11 include/toml11; \
else \
echo "Using committed header-only libraries"; \
echo "Using committed header libraries"; \
fi
RUN set -xe && \

View File

@@ -53,9 +53,7 @@ ARG SHA=""
ARG VERSION="dev"
ARG BUILD_DATE=""
ARG REFRESH_HEADERS=false
ARG QUICKJSPP_REF="01cdd3047ced48265b127790848a0ca88204f2c7"
ARG LIBCRON_REF="v1.3.3"
ARG TOML11_REF="v4.4.0"
ARG SOURCE_DEPS_CACHE_BUST=stable
ENV DEBIAN_FRONTEND=noninteractive
ENV PKG_CONFIG_ALLOW_CROSS=1
@@ -79,12 +77,9 @@ RUN dpkg --add-architecture armhf && \
COPY cmake/linux-armv7hf.cmake /opt/armv7-toolchain.cmake
RUN set -xe && \
git init quickjspp && \
echo "SOURCE_DEPS_CACHE_BUST=${SOURCE_DEPS_CACHE_BUST}" && \
git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/ftk/quickjspp.git quickjspp && \
cd quickjspp && \
git remote add origin https://github.com/ftk/quickjspp.git && \
git fetch --depth=1 origin "${QUICKJSPP_REF}" && \
git checkout --detach FETCH_HEAD && \
git submodule update --init && \
cmake -DCMAKE_TOOLCHAIN_FILE=/opt/armv7-toolchain.cmake -DCMAKE_BUILD_TYPE=Release . && \
make quickjs -j ${THREADS} && \
install -d /opt/armv7/lib/quickjs/ && \
@@ -94,12 +89,9 @@ RUN set -xe && \
install -m644 quickjspp.hpp /opt/armv7/include/
RUN set -xe && \
git init libcron && \
echo "SOURCE_DEPS_CACHE_BUST=${SOURCE_DEPS_CACHE_BUST}" && \
git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/PerMalmberg/libcron.git libcron && \
cd libcron && \
git remote add origin https://github.com/PerMalmberg/libcron && \
git fetch --depth=1 origin "${LIBCRON_REF}" && \
git checkout --detach FETCH_HEAD && \
git submodule update --init && \
cmake -DCMAKE_TOOLCHAIN_FILE=/opt/armv7-toolchain.cmake -DCMAKE_BUILD_TYPE=Release . && \
make libcron -j ${THREADS} && \
install -d /opt/armv7/lib/ && \
@@ -110,11 +102,9 @@ RUN set -xe && \
install -m644 libcron/externals/date/include/date/* /opt/armv7/include/date/
RUN set -xe && \
git init toml11 && \
echo "SOURCE_DEPS_CACHE_BUST=${SOURCE_DEPS_CACHE_BUST}" && \
git clone --depth=1 https://github.com/ToruNiina/toml11.git toml11 && \
cd toml11 && \
git remote add origin https://github.com/ToruNiina/toml11 && \
git fetch --depth=1 origin "${TOML11_REF}" && \
git checkout --detach FETCH_HEAD && \
install -d /opt/armv7/include && \
cp -a include/. /opt/armv7/include/
@@ -138,10 +128,18 @@ RUN set -xe && \
curl -fsSL https://raw.githubusercontent.com/pantor/inja/master/single_include/inja/inja.hpp -o include/inja.hpp && \
echo "Downloading latest jpcre2..." && \
curl -fsSL https://raw.githubusercontent.com/jpcre2/jpcre2/master/src/jpcre2.hpp -o include/jpcre2.hpp && \
echo "Copying pinned quickjspp from compiled source..." && \
cp /opt/armv7/include/quickjspp.hpp include/quickjspp.hpp; \
echo "Copying latest quickjspp from compiled source..." && \
cp /opt/armv7/include/quickjspp.hpp include/quickjspp.hpp && \
echo "Copying latest libcron headers from compiled source..." && \
rm -rf include/libcron include/date && \
cp -a /libcron/libcron/include/libcron include/libcron && \
cp -a /libcron/libcron/externals/date/include/date include/date && \
echo "Copying latest toml11 headers from compiled source..." && \
rm -rf include/toml11 && \
cp /toml11/include/toml.hpp include/toml.hpp && \
cp -a /toml11/include/toml11 include/toml11; \
else \
echo "Using committed header-only libraries"; \
echo "Using committed header libraries"; \
fi
RUN set -xe && \

View File

@@ -1,5 +1,7 @@
find_path(LIBCRON_INCLUDE_DIR libcron/Cron.h)
find_path(DATE_INCLUDE_DIR date/date.h)
find_path(LIBCRON_INCLUDE_DIR libcron/Cron.h
PATHS "${CMAKE_SOURCE_DIR}/include")
find_path(DATE_INCLUDE_DIR date/date.h
PATHS "${CMAKE_SOURCE_DIR}/include")
find_library(LIBCRON_LIBRARY libcron)

View File

@@ -1,5 +1,6 @@
find_path(TOML11_INCLUDE_DIR
NAMES toml.hpp
PATHS "${CMAKE_SOURCE_DIR}/include"
)
set(TOML11_INCLUDE_DIRS "${TOML11_INCLUDE_DIR}")