Skip to content

添加build.yml、release.yml #18

添加build.yml、release.yml

添加build.yml、release.yml #18

Workflow file for this run

name: Qt GUI CI
on:
[push, pull_request, workflow_dispatch]
jobs:
build-package:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: Build and Package on ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.6.2'
host: ${{ startsWith(matrix.os, 'macos') && 'mac' || startsWith(matrix.os, 'windows') && 'windows' || 'linux' }}
target: 'desktop'
modules: 'qtcharts qtmultimedia'
- name: Comment out HAS_CDN using Perl
shell: bash
run: perl -i -pe 's/^DEFINES \+= HAS_CDN/# DEFINES += HAS_CDN/' yunying.pro
- name: Print event
run: |
echo "github.event: toJSON(github.event)"
# 仅在 Windows 上设置 MSVC 2019
- name: Setup MSVC 2019 (Windows only)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
toolset: 14.29 # MSVC 2019 (v142)
# 验证 MSVC 2019 是否可用(仅 Windows)
- name: Check cl.exe (Windows only)
if: runner.os == 'Windows'
shell: cmd
run: |
where cl
cl /?
if %errorlevel% neq 0 (
echo "Error: MSVC 2019 (cl.exe) not found!"
exit /b 1
)
echo "MSVC 2019 is ready!"
# 其他平台的逻辑(可选)
- name: Linux-specific step
if: runner.os == 'Linux'
run: echo "Running on Linux"
- name: macOS-specific step
if: runner.os == 'macOS'
run: echo "Running on macOS"
- name: Configure with qmake
run: |
qmake .
- name: Build on Windows
if: runner.os == 'Windows'
run: nmake
- name: Build on MacOs
if: runner.os == 'macOS'
run: make
- name: Build on Linux
if: runner.os == 'Linux'
run: make