mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
232 lines
7.0 KiB
YAML
232 lines
7.0 KiB
YAML
name: C/C++ CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
- master
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
jobs:
|
|
format:
|
|
name: Check C/C++ formatting
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: '24'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Check formatting of changed files
|
|
run: npm run format:check -- origin/${{ github.base_ref || 'develop' }}
|
|
|
|
- name: Check version consistency
|
|
run: node scripts/sync-versions.mjs --check
|
|
|
|
build:
|
|
needs: format
|
|
env:
|
|
TARGET_MAJOR: 3
|
|
TARGET_VERSION: 3.0.0
|
|
TARGET_KIND: static
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ['ubuntu-latest', 'windows-latest']
|
|
runs-on: ${{ matrix.os }}
|
|
name: "Builds binaries on ${{ matrix.os }}"
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
submodules: recursive
|
|
|
|
- uses: xmake-io/github-action-setup-xmake@v1
|
|
with:
|
|
package-cache: true
|
|
actions-cache-folder: '.xmake-cache'
|
|
|
|
- name: Install tools
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update --fix-missing
|
|
sudo apt-get install debhelper lcov valgrind xvfb -yy
|
|
sudo apt-get install libfreetype6-dev libpng-dev libyaml-dev libomp-dev libx11-dev ninja-build fontconfig libfontconfig1-dev libjpeg-dev
|
|
|
|
- name: Configure
|
|
if: runner.os == 'Windows'
|
|
run: xmake config -y -v -k ${{ env.TARGET_KIND }} -m release --ci-env=y
|
|
|
|
- name: Configure for coverage mode
|
|
if: runner.os == 'Linux'
|
|
run: xmake config -y -v -k ${{ env.TARGET_KIND }} -m coverage --ci-env=y --memcheck=y
|
|
|
|
- name: Build
|
|
run: xmake
|
|
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: '22'
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install doc-viewer dependencies
|
|
working-directory: examples/doc-viewer
|
|
run: bun install
|
|
|
|
- name: Install lcui-cli
|
|
run: npm install -g @lcui/cli
|
|
|
|
- name: Test repository star script
|
|
run: node --test scripts/fetch-repo-stars.test.js
|
|
|
|
- name: Generate repository star counts
|
|
run: node scripts/fetch-repo-stars.js
|
|
|
|
- name: Generate doc-viewer sources
|
|
working-directory: examples/doc-viewer
|
|
run: bun run compile
|
|
|
|
- name: Process doc-viewer TSX files
|
|
working-directory: examples/doc-viewer
|
|
run: lcui build
|
|
|
|
- name: Run all tests
|
|
if: runner.os == 'Windows'
|
|
run: xmake test
|
|
|
|
- name: Run ctest tests
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "ctest-tests/*"
|
|
|
|
- name: Run pandagl tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "pandagl-tests/*"
|
|
|
|
- name: Run libcss tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "libcss-tests/*"
|
|
|
|
- name: Run libi18n tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "libi18n-tests/*"
|
|
|
|
- name: Run libptk tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "libptk-tests/*"
|
|
|
|
- name: Run librouter tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "librouter-tests/*"
|
|
|
|
- name: Run libthread tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "libthread-tests/*"
|
|
|
|
- name: Run libui-xml tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "libui-xml-tests/*"
|
|
|
|
- name: Run doc-viewer tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "doc-viewer-tests/*"
|
|
|
|
- name: Run integration tests with memcheck
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run -a xmake test "lcui-tests/*"
|
|
|
|
- name: Upload reports to Codecov
|
|
if: runner.os == 'Linux'
|
|
uses: codecov/codecov-action@v7
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
fail_ci_if_error: false
|
|
|
|
- name: Build for release (merged archive)
|
|
run: |
|
|
xmake config -y -v -k ${{ env.TARGET_KIND }} -m release --merge-archive=y
|
|
xmake
|
|
|
|
- name: Package
|
|
run: |
|
|
xmake package
|
|
xmake install -o dist/lcui-package
|
|
|
|
- name: Build binary archive
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
shell: pwsh
|
|
run: |
|
|
$plat = if ($env:RUNNER_OS -eq 'Windows') { 'windows' } else { 'linux' }
|
|
$version = $env:GITHUB_REF -replace '^refs/tags/v', ''
|
|
xmake install -o dist/lcui-bin lcui
|
|
Compress-Archive -Path dist/lcui-bin/* -DestinationPath "dist/lcui-$version-$plat-x64.zip"
|
|
Get-Item "dist/lcui-$version-$plat-x64.zip" | Select-Object Name, Length
|
|
|
|
- name: Build examples
|
|
run: xmake build -yg lcui-examples
|
|
|
|
- name: Install examples
|
|
run: xmake install -o dist/lcui-examples -g lcui-examples
|
|
|
|
- name: Build examples archive
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
shell: pwsh
|
|
run: |
|
|
$plat = if ($env:RUNNER_OS -eq 'Windows') { 'windows' } else { 'linux' }
|
|
$version = $env:GITHUB_REF -replace '^refs/tags/v', ''
|
|
Compress-Archive -Path dist/lcui-examples/* -DestinationPath "dist/lcui-$version-$plat-x64-examples.zip"
|
|
Get-Item "dist/lcui-$version-$plat-x64-examples.zip" | Select-Object Name, Length
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: lcui${{ env.TARGET_MAJOR }}-${{ env.TARGET_VERSION }}-${{ env.TARGET_KIND }} (${{ runner.os }})
|
|
path: |
|
|
dist/lcui-package
|
|
dist/lcui-*.zip
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: lcui${{ env.TARGET_MAJOR }}-examples (${{ runner.os }})
|
|
path: |
|
|
dist/lcui-examples
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
needs: [build]
|
|
env:
|
|
ARTIFACT_DIR: ./release
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
path: ${{ env.ARTIFACT_DIR }}
|
|
|
|
- name: Set release version
|
|
run: python ./.github/scripts/get_release_version.py
|
|
|
|
- name: Create release
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
release_name: LCUI ${{ env.REL_VERSION }}
|
|
tag: ${{ github.ref }}
|
|
# upload-release-action skips directories instead of walking them, so the
|
|
# glob must reach the zip file itself. "**" keeps it independent of how
|
|
# download-artifact nests each artifact under ARTIFACT_DIR.
|
|
file: ${{ env.ARTIFACT_DIR }}/**/lcui-*.zip
|
|
overwrite: true
|
|
file_glob: true
|