mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
187 lines
5.0 KiB
YAML
187 lines
5.0 KiB
YAML
name: C/C++ CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- develop
|
|
- release-*
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
ubuntu_build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ['ubuntu-latest']
|
|
runs-on: ${{ matrix.os }}
|
|
name: "Builds binaries on ${{ matrix.os }}"
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: install tools
|
|
run: sudo apt install debhelper lcov valgrind
|
|
|
|
- name: make
|
|
run: |
|
|
./autogen.sh
|
|
./configure --enable-debug --enable-code-coverage
|
|
make
|
|
|
|
- name: Run tests
|
|
run: |
|
|
make test
|
|
make test-with-valgrind
|
|
|
|
- name: Upload reports to Codecov
|
|
run: bash <(curl -s https://codecov.io/bash);
|
|
|
|
- name: Package
|
|
run: |
|
|
make distcheck
|
|
sh ./scripts/make-dist-deb.sh
|
|
|
|
- uses: actions/upload-artifact@master
|
|
with:
|
|
name: build-ubuntu
|
|
path: |
|
|
build/debian/*.deb
|
|
|
|
windows_build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ['windows-2016']
|
|
include:
|
|
- os: 'windows-2016'
|
|
triplet: 'x64-windows'
|
|
runs-on: ${{ matrix.os }}
|
|
name: "Builds binaries on ${{ matrix.os }}"
|
|
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
|
|
# vcpkg cache bug fix
|
|
# NOTE: needs further investigation
|
|
# https://github.com/lukka/run-vcpkg/issues/61
|
|
- name: "vcpkg fix"
|
|
run: attrib -r "c:\vcpkg\.git\*.*" /s
|
|
# VCPKG
|
|
- name: Run vcpkg
|
|
uses: lukka/run-vcpkg@main
|
|
with:
|
|
vcpkgDirectory: ${{ github.workspace }}/vcpkg/
|
|
vcpkgTriplet: ${{ matrix.triplet }}
|
|
vcpkgGitCommitId: 7db401cb1ef1fc559ec9f9ce814d064c328fd767
|
|
setupOnly: true
|
|
appendedCacheKey: ${{ hashFiles('lcpkg.json') }}
|
|
additionalCachedPaths: ./lcpkg/
|
|
|
|
- name: "Display versions"
|
|
run: |
|
|
node -v
|
|
npm -va
|
|
vcpkg version
|
|
|
|
- name: Cache lcpkg dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ github.workspace }}/vcpkg/
|
|
key: ${{ matrix.os }}
|
|
|
|
- name: "Install lcpkg"
|
|
run: |
|
|
npm install -g lcpkg
|
|
lcpkg config vcpkg.root ${{ github.workspace }}/vcpkg/
|
|
lcpkg install
|
|
lcpkg install --arch x64
|
|
lcpkg install --platform uwp
|
|
lcpkg install --platform uwp --arch x64
|
|
|
|
- name: Cache windows build tools
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.windows-build-tools
|
|
key: ${{ matrix.os }}
|
|
|
|
- name: "Setup windows-build-tools"
|
|
run: npm install --global --production windows-build-tools --vs2015
|
|
|
|
- name: "Setup msbuild"
|
|
uses: microsoft/setup-msbuild@v1.0.2
|
|
|
|
- name: "Use config"
|
|
run: copy .\include\config.win32.h.in .\include\config.h
|
|
|
|
- name: "Build"
|
|
run: |
|
|
msbuild build/windows/LCUI.sln /p:Configuration=Debug /p:Platform=x86 /verbosity:minimal
|
|
msbuild build/windows/LCUI.sln /p:Configuration=Debug /p:Platform=x64 /verbosity:minimal
|
|
msbuild build/windows/LCUI.sln /p:Configuration=Release /p:Platform=x86 /verbosity:minimal
|
|
msbuild build/windows/LCUI.sln /p:Configuration=Release /p:Platform=x64 /verbosity:minimal
|
|
|
|
- name: "Run tests"
|
|
continue-on-error: true
|
|
run: |
|
|
msbuild build\windows\LCUI-Demo.sln /p:Configuration=Debug /p:Platform=x64 /verbosity:minimal
|
|
cd test
|
|
..\bin\x64-windows\Debug\LCUITest.exe
|
|
|
|
- name: "Pack"
|
|
run: |
|
|
lcpkg pack
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@master
|
|
with:
|
|
name: build-windows
|
|
path: .\lcpkg\dist\*.zip
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
needs: [ubuntu_build, windows_build]
|
|
env:
|
|
ARTIFACT_DIR: ./release
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Download artifacts [build-ubuntu]
|
|
uses: actions/download-artifact@master
|
|
with:
|
|
name: build-ubuntu
|
|
path: ${{ env.ARTIFACT_DIR }}
|
|
|
|
- name: Download artifacts [build-windows]
|
|
uses: actions/download-artifact@master
|
|
with:
|
|
name: build-windows
|
|
path: ${{ env.ARTIFACT_DIR }}
|
|
|
|
- name: Set release version
|
|
run: python ./.github/scripts/get_release_version.py
|
|
|
|
- name: Create release notes
|
|
run: python ./.github/scripts/get_release_notes.py
|
|
|
|
- name: Read package.json
|
|
id: release_notes
|
|
uses: juliangruber/read-file-action@v1
|
|
with:
|
|
path: RELEASE_NOTES.md
|
|
trim: false
|
|
|
|
- name: Create release
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
body: ${{ steps.release_notes.outputs.content }}
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
release_name: LCUI ${{ env.REL_VERSION }}
|
|
tag: ${{ github.ref }}
|
|
file: ${{ env.ARTIFACT_DIR }}/*
|
|
overwrite: true
|
|
file_glob: true
|