#c #cmake #github-actions
Вопрос:
Я использую действия github с матрицей (Windows, osx, Linux), и я хочу создать свою программу на C , которая будет скомпилирована для win32 и win64, а также OSX/Intel и OSX/ARM (для каждой платформы возможна другая работа). Как я могу это сделать?
# Copyright (c) 2019-2020-2021 Luca Cappa
# Released under the term specified in file LICENSE.txt
# SPDX short identifier: MIT
name: Build and test
on:
push:
braches:
- main
- github-actions
jobs:
job:
name: ${{ matrix.os }}-hosted-basic
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
- os: macos-latest
triplet: x64-osx
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: lukka/get-cmake@latest
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Install clang-tidy
if: matrix.os == 'ubuntu-latest'
run : sudo apt install clang-tidy
- name: Configure build (CMake Ninja)
uses: lukka/run-cmake@main
id: runcmake
with:
cmakeGenerator: 'Ninja'
cmakeListsOrSettingsJson: 'CMakeListsTxtBasic'
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildWithCMakeArgs: '-- -v'
buildDirectory: '${{ runner.workspace }}/b/${{ runner.os }}'
- name: Run clang format
if: matrix.os == 'ubuntu-latest'
run : |
ninja -C '${{ runner.workspace }}/b/${{ runner.os }}' clang-format
echo ninja -C '${{ runner.workspace }}/b/${{ runner.os }}' check-clang-format
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: build-${{ steps.vars.outputs.sha_short }}
path: '${{ runner.workspace }}/b/'
(Я предполагаю,что мог бы дважды выполнить задание Windows, но это не идеально)