From a5f90357b29a7e2f27ac1beed77426f3ff3bc63b Mon Sep 17 00:00:00 2001 From: thorium <102315529+thorium-cfx@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:13:32 +0100 Subject: [PATCH] Compatibility generation (automatic, push) * Enables the compatgen on each push. * Clone latest native-doc-tools instead of a specific commit. --- .ci/run-deploy | 13 +++++++++---- .ci/setup-builder | 10 +++++++--- .github/workflows/deploy-repo.yml | 20 ++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.ci/run-deploy b/.ci/run-deploy index e87c7bbaf..f42d378f0 100644 --- a/.ci/run-deploy +++ b/.ci/run-deploy @@ -2,18 +2,23 @@ set -eu +repo_root="$(pwd)" +ci_root="$(dirname "$0")" + # include common script -. "$(dirname "$0")"/common.sh +. "$ci_root"/common.sh title "Building new documentation output...\n" -repo_root="$(pwd)" - mkdir -p out +# Native generation pushd "$BUILDER_ROOT" node index.js "$repo_root" cp -a natives_test.json "$repo_root/out/natives.json" node build-template.js lua > "$repo_root/out/natives.lua" node build-template.js reference > "$repo_root/out/natives.html" -popd \ No newline at end of file +popd + +# Compatibility native generation +"$ci_root"/run-compat "$BUILDER_ROOT" "./out/natives_global_client_compat.lua" "./in/natives_global_client_compat.lua" diff --git a/.ci/setup-builder b/.ci/setup-builder index 337b720f7..5f99a41aa 100644 --- a/.ci/setup-builder +++ b/.ci/setup-builder @@ -10,8 +10,12 @@ sudo ln -s libclang-10.so.1 /usr/lib/x86_64-linux-gnu/libclang.so mkdir -p $BUILDER_ROOT cd $BUILDER_ROOT -git init -q . -git fetch -q --depth=1 https://github.com/citizenfx/native-doc-tooling.git 59821abdd96caf23be103bfa0da3c799ce690df9 -git checkout FETCH_HEAD +# shallow clone latest +git clone --depth=1 https://github.com/citizenfx/native-doc-tooling.git ./ + +# shallow clone specific commit +#git init -q . +#git fetch -q --depth=1 https://github.com/citizenfx/native-doc-tooling.git 59821abdd96caf23be103bfa0da3c799ce690df9 +#git checkout FETCH_HEAD yarn \ No newline at end of file diff --git a/.github/workflows/deploy-repo.yml b/.github/workflows/deploy-repo.yml index b21fcc3f5..17b091631 100644 --- a/.github/workflows/deploy-repo.yml +++ b/.github/workflows/deploy-repo.yml @@ -12,21 +12,29 @@ jobs: - uses: actions/checkout@v2 with: path: './' + fetch-depth: 2 - uses: actions/setup-node@v2 with: node-version: '12' # while 14+ technically works, it's 25-50x slower at running native-doc-tooling - - name: Run build - run: | - set -xe - bash ./.ci/setup-builder - bash ./.ci/run-deploy - name: Install SSH key uses: shimataro/ssh-key-action@v2 with: key: ${{ secrets.NATIVE_DEPLOY_KEY }} known_hosts: ${{ secrets.NATIVE_DEPLOY_KNOWN_HOSTS }} + - name: Acquire latest compat file + env: + NATIVE_DEPLOY_URL: ${{ secrets.NATIVE_DEPLOY_URL }} + run: | + mkdir ./in + rsync -q --ignore-missing-args $NATIVE_DEPLOY_URL/natives_global_client_compat.lua ./in/natives_global_client_compat.lua + - name: Run build + run: | + set -xe + bash ./.ci/setup-builder + bash ./.ci/run-deploy - name: Deploy env: NATIVE_DEPLOY_URL: ${{ secrets.NATIVE_DEPLOY_URL }} run: | - rsync -r --delete-after --quiet ./out/ $NATIVE_DEPLOY_URL \ No newline at end of file + rsync -rq --delete-after --exclude=*compat.lua* ./out/ $NATIVE_DEPLOY_URL + rsync -rqb --backup-dir=./ --suffix=.bak --include=*compat.lua --exclude=* ./out/ $NATIVE_DEPLOY_URL