qskinny/.github/workflows/cmake.yml

340 lines
12 KiB
YAML

name: CMake Build Matrix
on:
push:
branches: [cmake]
pull_request:
branches: [master]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MSVC Qt5",
os: windows-latest,
artifact: "windows_msvc.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
archiver: "7z a",
generators: "Visual Studio 17 2022",
cmake:
{
qtversion: "5.15.2",
qtdirkey: "Qt5_DIR",
qtdirvalue: "../Qt/5.15.2/msvc2019_64/lib/cmake/Qt5",
},
}
- {
name: "Windows Latest MSVC Qt6",
os: windows-latest,
artifact: "windows_msvc.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
archiver: "7z a",
generators: "Visual Studio 17 2022",
cmake:
{
qtversion: "6.2.4",
qtdirkey: "Qt6_DIR",
qtdirvalue: "../Qt/6.2.4/msvc2019_64/lib/cmake/Qt6",
},
}
- {
name: "Windows 2019 MSVC Qt5",
os: windows-2019,
artifact: "windows_msvc.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
archiver: "7z a",
generators: "Visual Studio 16 2019",
cmake:
{
qtversion: "5.15.2",
qtdirkey: "Qt5_DIR",
qtdirvalue: "../Qt/5.15.2/msvc2019_64/lib/cmake/Qt5",
},
}
- {
name: "Windows 2019 MSVC Qt6",
os: windows-2019,
artifact: "windows_msvc.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
archiver: "7z a",
generators: "Visual Studio 16 2019",
cmake:
{
qtversion: "6.2.4",
qtdirkey: "Qt6_DIR",
qtdirvalue: "../Qt/6.2.4/msvc2019_64/lib/cmake/Qt6",
},
}
- {
name: "Ubuntu Latest GCC Qt5",
os: ubuntu-latest,
artifact: "ubuntu_gcc.7z",
build_type: "Release",
cc: "gcc",
cxx: "g++",
archiver: "7z a",
generators: "Ninja",
cmake:
{
qtversion: "5.15.2",
qtdirkey: "Qt5_DIR",
qtdirvalue: "../Qt/5.15.2/gcc_64/lib/cmake/Qt5",
},
}
- {
name: "Ubuntu Latest GCC Qt6",
os: ubuntu-latest,
artifact: "ubuntu_gcc.7z",
build_type: "Release",
cc: "gcc",
cxx: "g++",
archiver: "7z a",
generators: "Ninja",
cmake:
{
qtversion: "6.2.4",
qtdirkey: "Qt6_DIR",
qtdirvalue: "../Qt/6.2.4/gcc_64/lib/cmake/Qt6",
},
}
- {
name: "Ubuntu GCC 9 Qt5",
os: ubuntu-latest,
artifact: "ubuntu_gcc9.7z",
build_type: "Release",
cc: "gcc",
cxx: "g++",
archiver: "7z a",
generators: "Ninja",
cmake:
{
qtversion: "5.15.2",
qtdirkey: "Qt5_DIR",
qtdirvalue: "../Qt/5.15.2/gcc_64/lib/cmake/Qt5",
},
}
- {
name: "Ubuntu GCC 9 Qt6",
os: ubuntu-latest,
artifact: "ubuntu_gcc9.7z",
build_type: "Release",
cc: "gcc",
cxx: "g++",
archiver: "7z a",
generators: "Ninja",
cmake:
{
qtversion: "6.2.4",
qtdirkey: "Qt6_DIR",
qtdirvalue: "../Qt/6.2.4/gcc_64/lib/cmake/Qt6",
},
}
- {
name: "macOS Latest Clang Qt5",
os: macos-latest,
artifact: "macos_clang.7z",
build_type: "Release",
cc: "clang",
cxx: "clang++",
archiver: "7za a",
generators: "Ninja",
cmake:
{
qtversion: "5.15.2",
qtdirkey: "Qt5_DIR",
qtdirvalue: "../Qt/5.15.2/clang_64/lib/cmake/Qt5",
},
}
- {
name: "macOS Latest Clang Qt6",
os: macos-latest,
artifact: "macos_clang.7z",
build_type: "Release",
cc: "clang",
cxx: "clang++",
archiver: "7za a",
generators: "Ninja",
cmake:
{
qtversion: "6.2.4",
qtdirkey: "Qt6_DIR",
qtdirvalue: "../Qt/6.2.4/clang_64/lib/cmake/Qt6",
},
}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install ninja cmake
ninja --version
cmake --version
# cmd "${{ matrix.config.environment_script }}"
- name: Install dependencies on ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
sudo apt-get update
sudo apt-get install ninja-build cmake
ninja --version
cmake --version
gcc --version
- name: Install dependencies on ubuntu9
if: startsWith(matrix.config.name, 'Ubuntu_GCC_9')
run: |
echo Update gcc-9 =======================================================================
echo gcc version before
gcc --version
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install ninja-build cmake gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
echo gcc version after
gcc --version
echo Update ninja =======================================================================
echo ninja version before
ninja --version
# wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
wget https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
sudo unzip ninja-linux.zip -d /usr/local/bin/
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
echo ninja version after
ninja --version
echo Update cmake =======================================================================
echo cmake version before
cmake --version
# curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2
# wget https://github.com/Kitware/CMake/releases/latest/download/cmake-3.16.5-Linux-x86_64.sh
cmake_version=$(curl --silent "https://api.github.com/repos/Kitware/CMake/releases/latest" | sed -n 's/.*tag_name":\s"\(.*\)".*/\1/p' | head -2 | cut -c 2-)
echo cmake download latest v$cmake_version version
wget https://github.com/Kitware/CMake/releases/download/v$cmake_version/cmake-$cmake_version-Linux-x86_64.sh
chmod +x cmake-$cmake_version-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo ./cmake-$cmake_version-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
sudo update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 1 --force
echo cmake version after
cmake --version
- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install p7zip cmake ninja
ninja --version
cmake --version
- uses: actions/checkout@v2
- name: Cache Qt5
if: endsWith(matrix.config.name, 'Qt5')
id: cache-qt-5-15
uses: actions/cache@v1 # not v2!
with:
path: ../Qt/5.15.2
key: ${{ runner.os }}-QtCache-Qt5
- name: Cache Qt6
if: endsWith(matrix.config.name, 'Qt6')
id: cache-qt-6-2
uses: actions/cache@v1 # not v2!
with:
path: ../Qt/6.2.4
key: ${{ runner.os }}-QtCache-Qt6
- name: Install Qt5
if: endsWith(matrix.config.name, 'Qt5')
uses: jurplel/install-qt-action@v3
with:
version: "5.15.2"
target: "desktop"
install-deps: "true"
modules: "qtwebengine"
cached: ${{ steps.cache-qt-5-15.outputs.cache-hit }}
setup-python: "false"
tools: ""
set-env: "true"
tools-only: "false"
- name: Install Qt6
if: endsWith(matrix.config.name, 'Qt6')
uses: jurplel/install-qt-action@v3
with:
version: "6.2.4"
target: "desktop"
install-deps: "true"
modules: "qtwebengine"
cached: ${{ steps.cache-qt-6-2.outputs.cache-hit }}
setup-python: "false"
tools: ""
set-env: "true"
tools-only: "false"
- name: Configure
shell: bash
run: |
mkdir build
mkdir instdir
cmake \
-S . \
-B . \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir \
-D${{ matrix.config.cmake.qtdirkey }}:PATH="${{ matrix.config.cmake.qtdirvalue }}"
- name: Build
shell: bash
run: cmake --build . --config ${{ matrix.config.build_type }}
#- name: Tests
# shell: bash
# run: ctest -j14 -C Release -T test --output-on-failure
# - name: Install Strip
# shell: bash
# run: cmake --install . --strip
# - name: Pack
# shell: bash
# working-directory: instdir
# run: |
# ls -laR
# ${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} .
# - name: Upload
# uses: actions/upload-artifact@v1
# with:
# path: ./${{ matrix.config.artifact }}
# name: ${{ matrix.config.artifact }}
# - name: Upload release asset
# if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created')
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: ./${{ matrix.config.artifact }}
# asset_name: ${{ matrix.config.artifact }}.zip
# asset_content_type: application/zip