github aciotn的简单使用

前言

遇到没有文档的项目时,CI文件可以帮助我们,了解项目该如何编译。本文仅尝试使用GitHub Actions文档 - GitHub 文档,作为C++项目的CI。有 gitlib-ci的简单使用的体验之后,github的action比较容易上手。

除了官方文档外,这里给出另外的参考链接:


github action的简单使用

本节仓库:GitHub - da1234cao/github-action-demo: github action demo

目标:一个简单的C++项目。项目需要在windows和linux上编译。项目依赖qt和boost。

编写CI脚本,照葫芦画瓢即可。没有看到很好的葫芦,这个可以参考:Qt使用github-Actions自动化编译 - 知乎

这里不进行详细介绍,阅读完上面的链接,自可明白。在Github Actions workflows中安装qt和boost: Install Qt · Actions · GitHub Marketplace · GitHubDownload and install Boost · Actions · GitHub Marketplace · GitHub

name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions
on: [push]
jobs:
  build-on-window-22:
    runs-on: windows-2022
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3
        with:
          fetch-depth: 1
      - name: install boost
        id: install-boost
        uses: MarkusJx/install-boost@v2.4.1
        with:
          boost_version: '1.80.0'
          platform_version: 2022
          toolset: 'msvc'
      - name: install qt
        uses: jurplel/install-qt-action@v3
        with:
          version: '5.15.2'
          host: 'windows'
          target: 'desktop'
          arch: 'win64_msvc2019_64'
      - name: build demo
        run: |
          mkdir build
          cd build
          cmake ..
          cmake --build . --config Release
        env:
          BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

  build-on-ubuntu-22:
    runs-on: ubuntu-22.04
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3
        with:
          fetch-depth: 1
      - name: install boost
        id: install-boost
        uses: MarkusJx/install-boost@v2.4.1
        with:
          boost_version: '1.80.0'
          platform_version: 22.04
          toolset: 'gcc'

      - name: install qt
        uses: jurplel/install-qt-action@v3
        with:
          version: '5.15.2'
          target: 'desktop'
      - name: build demo
        run: |
          mkdir build
          cd build
          cmake ..
          make
        env:
          BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

da1234cao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值