hercules/.github/workflows/windows.yml
Ibrahim Zidan 3d3a63914c
Implemented a github action step that pre-compiles all conan
dependencies and caches them for use in later builds, improving build
speed.

Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
2026-07-21 02:03:50 +03:00

79 lines
3 KiB
YAML

name: build windows
on: workflow_call
env:
MYSQL_DATABASE: 'ragnarok'
MYSQL_USER: 'ragnarok'
MYSQL_PASSWORD: 'ragnarok'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
jobs:
build:
runs-on: windows-2025
timeout-minutes: 30
strategy:
matrix:
CC: [msvc]
RENEWAL: ["", "-DENABLE_RENEWAL=OFF"]
CLIENT_TYPE: ["", "-DENABLE_PACKETVER_RE=ON", "-DENABLE_PACKETVER_ZERO=ON"]
HTTPLIB: ["", "-DWITH_HTTP_PARSER=llhttp"]
PACKET_VERSION: ["-DPACKETVER=20221024", "-DPACKETVER=20130724"]
include:
# Empty CLASSIC_AUTOSPELL_LIST for every other flow
- CLASSIC_AUTOSPELL_LIST: ""
# Use "-DCLASSIC_AUTOSPELL_LIST" for 20130724 RE or we will get warnings due to the list being too small
- PACKET_VERSION: "-DPACKETVER=20130724"
RENEWAL: ""
CLASSIC_AUTOSPELL_LIST: "-DENABLE_CLASSIC_AUTOSPELL=ON"
exclude:
- PACKET_VERSION: "-DPACKETVER=20130724"
CLIENT_TYPE: "-DENABLE_PACKETVER_ZERO=ON"
# github.head_ref will stop previous runs in the same PR (if in a PR)
# github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop)
concurrency:
group: build_windows-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}_${{ matrix.RENEWAL }}_${{ matrix.CLIENT_TYPE }}_${{ matrix.HTTPLIB }}_${{ matrix.PACKET_VERSION}}
cancel-in-progress: true
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
# - name: install packages
# run: |
# winget install Ninja-build.Ninja cmake python3 --accept-source-agreements --accept-package-agreements --disable-interactivity --silent
- uses: actions/cache/restore@v6
name: restore conan cache
id: cache
with:
path: ~/.conan2
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
- uses: shogo82148/actions-setup-mysql@v1
with:
distribution: "mariadb"
mysql-version: "11.1"
- name: init database
run: |
mysql -u root -e "CREATE DATABASE IF NOT EXISTS ${{ env.MYSQL_DATABASE }};"
mysql -u root -e "CREATE USER IF NOT EXISTS '${{ env.MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ env.MYSQL_PASSWORD }}';"
mysql -u root -e "GRANT SELECT,INSERT,UPDATE,DELETE ON ${{ env.MYSQL_DATABASE }}.* TO '${{ env.MYSQL_USER }}'@'localhost';"
Get-Content sql-files/main.sql | mysql -u root ${{ env.MYSQL_DATABASE }}
Get-Content sql-files/logs.sql | mysql -u root ${{ env.MYSQL_DATABASE }}
- name: build
run: |
.\tools\ci\windows.ps1 build ${{ matrix.CLIENT_TYPE }} ${{ matrix.PACKET_VERSION}} ${{ matrix.RENEWAL }} ${{ matrix.HTTPLIB }} ${{ matrix.CLASSIC_AUTOSPELL_LIST }} -DENABLE_WERROR=ON -DENABLE_BUILDBOT=ON -DBUILD_HPMHOOKING=ON
- name: run
run: |
.\tools\ci\windows.ps1 run
- name: test
if: matrix.PACKET_VERSION != '-DPACKETVER=20130724'
run: |
.\tools\ci\windows.ps1 test