ncmdump/.github/workflows/autobuild.yml
2025-10-04 15:23:19 +08:00

67 lines
1.9 KiB
YAML

name: CI
env:
BUILD_TYPE: MinSizeRel
BUILD_PATH: build
on:
push:
branches: [ main, dev ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build_config: [Release]
runs-on: ${{ matrix.os }}
env:
VCPKG_TRIPLET: x64-windows-static
steps:
- name: 检出代码
uses: actions/checkout@v4
with:
submodules: true
- name: Install Dependencies - Ubuntu
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y build-essential cmake libtag1-dev
- name: Install Dependencies - macOS
if: runner.os == 'macOS'
run: |
brew install git cmake taglib
- name: Install Dependencies - Windows
uses: lukka/run-vcpkg@v12
with:
vcpkgJsonGlob: '**/vcpkg.json'
vcpkgTriplet: ${{ env.VCPKG_TRIPLET }}
# ----------------------------------------------------------------------
# CMake Configuration
# ----------------------------------------------------------------------
- name: Configure CMake
run: |
BUILD_DIR=${{ github.workspace }}/build
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${{ matrix.build_config }} -S ${{ github.workspace }}"
if [ "$RUNNER_OS" == "Windows" ]; then
CMAKE_TOOLCHAIN_FILE_PATH=$(echo ${{ steps.vcpkg.outputs.vcpkgToolchainFile }})
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE_PATH}"
cmake -B $BUILD_DIR $CMAKE_ARGS
else
cmake -B $BUILD_DIR $CMAKE_ARGS
fi
shell: bash
# ----------------------------------------------------------------------
# CMake Build
# ----------------------------------------------------------------------
- name: Build Targets
run: cmake --build ${{github.workspace}}/build --config ${{ matrix.build_config }}