mirror of
https://github.com/mehah/otclient
synced 2026-08-15 16:29:06 -04:00
ci(vcpkg): keep baseline updates synchronized and auto-mergeable Improve the vcpkg baseline updater so automated dependency PRs stay synchronized with main and can be queued for native GitHub auto-merge. Main changes: - Fetch full repository history before updating the baseline branch. - Synchronize the updater branch with the latest origin/main before applying baseline changes. - Rebase existing updater branches onto main. - Create missing updater branches directly from origin/main. - Use force-with-lease when refreshing bot-managed branches. - Restrict existing PR lookup to open baseline PRs targeting main. - Queue both existing and newly created baseline PRs for native GitHub squash auto-merge. - Set a consistent squash commit subject and body for automated baseline merges. - Validate PR numbers before attempting to enable auto-merge. - Warn and leave the PR open when auto-merge cannot be queued. - Continue triggering CI when the requested baseline is already present. - Update CI path filters so changes to update_vcpkg_baseline.yml trigger Windows, macOS, Android, Docker, and browser validation. Safety: - The updater does not approve reviews. - The updater does not bypass branch protection. - Auto-merge remains subject to required reviews and status checks. - Branch rewrites use force-with-lease instead of an unconditional force push. Validation: - actionlint passed. - YAML parsing passed. - Extracted updater shell script passed bash -n. - git diff --check passed. This makes automated vcpkg baseline maintenance more reliable by preventing stale update branches and allowing GitHub to complete the merge once all repository requirements are satisfied.
247 lines
8.6 KiB
YAML
247 lines
8.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
paths:
|
|
- "src/**"
|
|
- "tests/**"
|
|
- "cmake/**"
|
|
- "android/**"
|
|
- "browser/**"
|
|
- "data/**"
|
|
- "mods/**"
|
|
- "modules/**"
|
|
- "tools/**"
|
|
- "vc18/**"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
- "Dockerfile"
|
|
- "Dockerfile.browser"
|
|
- "Dockerfile.browser.sh"
|
|
- "build_luajit_android.sh"
|
|
- "setup_android_deps.sh"
|
|
- "init.lua"
|
|
- "otclientrc.lua"
|
|
- "cacert.pem"
|
|
- "config.ini"
|
|
- ".dockerignore"
|
|
- ".yamllint.yaml"
|
|
- ".reviewdog.yml"
|
|
- ".github/workflows/**"
|
|
merge_group:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "src/**"
|
|
- "tests/**"
|
|
- "cmake/**"
|
|
- "android/**"
|
|
- "browser/**"
|
|
- "data/**"
|
|
- "mods/**"
|
|
- "modules/**"
|
|
- "tools/**"
|
|
- "vc18/**"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
- "Dockerfile"
|
|
- "Dockerfile.browser"
|
|
- "Dockerfile.browser.sh"
|
|
- "build_luajit_android.sh"
|
|
- "setup_android_deps.sh"
|
|
- "init.lua"
|
|
- "otclientrc.lua"
|
|
- "cacert.pem"
|
|
- "config.ini"
|
|
- ".dockerignore"
|
|
- ".yamllint.yaml"
|
|
- ".reviewdog.yml"
|
|
- ".github/workflows/**"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
name: Detect Build Scope
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
compile: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group') && 'true' || steps.filter.outputs.compile }}
|
|
macos: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group') && 'true' || steps.filter.outputs.macos }}
|
|
android: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group') && 'true' || steps.filter.outputs.android }}
|
|
docker: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group') && 'true' || steps.filter.outputs.docker }}
|
|
browser: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group') && 'true' || steps.filter.outputs.browser }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Detect changed paths
|
|
id: filter
|
|
if: github.event_name != 'workflow_dispatch' && github.event_name != 'merge_group'
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
|
|
with:
|
|
filters: |
|
|
compile:
|
|
- "src/**"
|
|
- "tests/**"
|
|
- "cmake/**"
|
|
- "vc18/**"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
- ".yamllint.yaml"
|
|
- ".reviewdog.yml"
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/reusable-build-linux.yml"
|
|
- ".github/workflows/reusable-build-windows.yml"
|
|
- ".github/workflows/reusable-checks.yml"
|
|
- ".github/workflows/reusable-tests-lua.yml"
|
|
- ".github/workflows/update_vcpkg_baseline.yml"
|
|
macos:
|
|
- "src/**"
|
|
- "cmake/**"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/reusable-build-macos.yml"
|
|
- ".github/workflows/update_vcpkg_baseline.yml"
|
|
android:
|
|
- "src/**"
|
|
- "android/**"
|
|
- "cmake/**"
|
|
- "CMakeLists.txt"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "build_luajit_android.sh"
|
|
- "setup_android_deps.sh"
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/reusable-build-android-apk.yml"
|
|
- ".github/workflows/update_vcpkg_baseline.yml"
|
|
docker:
|
|
- "Dockerfile"
|
|
- ".dockerignore"
|
|
- "src/**"
|
|
- "cmake/**"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "CMakeLists.txt"
|
|
- "CMakePresets.json"
|
|
- ".yamllint.yaml"
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/reusable-build-docker.yml"
|
|
- ".github/workflows/update_vcpkg_baseline.yml"
|
|
browser:
|
|
- "Dockerfile.browser"
|
|
- "Dockerfile.browser.sh"
|
|
- "browser/**"
|
|
- "src/**"
|
|
- "cmake/**"
|
|
- "vcpkg.json"
|
|
- "vcpkg-configuration.json"
|
|
- "overlay-ports/**"
|
|
- "CMakeLists.txt"
|
|
- ".yamllint.yaml"
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/reusable-build-browser.yml"
|
|
- ".github/workflows/update_vcpkg_baseline.yml"
|
|
|
|
checks:
|
|
name: Fast Checks
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
|
|
permissions:
|
|
contents: read
|
|
checks: write
|
|
pull-requests: read
|
|
uses: ./.github/workflows/reusable-checks.yml
|
|
secrets: inherit
|
|
|
|
tests-lua:
|
|
name: Lua Syntax
|
|
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
|
|
permissions:
|
|
contents: read
|
|
uses: ./.github/workflows/reusable-tests-lua.yml
|
|
secrets: inherit
|
|
|
|
build-linux:
|
|
name: Build - Linux
|
|
needs: [changes, checks, tests-lua]
|
|
if: needs.changes.outputs.compile == 'true' && needs.checks.result == 'success' && needs.tests-lua.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
uses: ./.github/workflows/reusable-build-linux.yml
|
|
secrets: inherit
|
|
|
|
build-windows:
|
|
name: Build - Windows
|
|
needs: [changes, checks, tests-lua]
|
|
if: needs.changes.outputs.compile == 'true' && needs.checks.result == 'success' && needs.tests-lua.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
uses: ./.github/workflows/reusable-build-windows.yml
|
|
secrets: inherit
|
|
|
|
build-macos:
|
|
name: Build - macOS
|
|
needs: [changes, checks, tests-lua]
|
|
if: needs.changes.outputs.macos == 'true' && needs.checks.result == 'success' && needs.tests-lua.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
uses: ./.github/workflows/reusable-build-macos.yml
|
|
secrets: inherit
|
|
|
|
build-android-apk:
|
|
name: Build - Android APK
|
|
needs: [changes, checks, tests-lua]
|
|
if: needs.changes.outputs.android == 'true' && needs.checks.result == 'success' && needs.tests-lua.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
uses: ./.github/workflows/reusable-build-android-apk.yml
|
|
secrets: inherit
|
|
|
|
build-docker:
|
|
name: Build - Docker
|
|
needs: [changes, checks, tests-lua]
|
|
if: needs.changes.outputs.docker == 'true' && needs.checks.result == 'success' && needs.tests-lua.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
uses: ./.github/workflows/reusable-build-docker.yml
|
|
with:
|
|
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
vcpkg_binary_cache_access: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'readwrite' || 'read' }}
|
|
secrets: inherit
|
|
|
|
build-browser:
|
|
name: Build - Browser
|
|
needs: [changes, checks, tests-lua]
|
|
if: needs.changes.outputs.browser == 'true' && needs.checks.result == 'success' && needs.tests-lua.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
|
|
permissions:
|
|
contents: read
|
|
uses: ./.github/workflows/reusable-build-browser.yml
|
|
secrets: inherit
|