This GitHub action sets up selected C/C++ compiler in your workflow run.
The action requires specyfing compiler version using compiler
input.
Use it in your workflow like this:
- name: Install compiler
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: latest
Output variables:
cc
- holds C compilercxx
- holds C++ compiler
Example usage:
- name: Use compiler
shell: bash
env:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}
Currently only Ubuntu and Windows are fully supported. For MacOS it is possible to install selected gcc
however clang
will always fallback to system default.
The input compiler
can take following names:
latest
- resolves to the default gcc on a given systemgcc
orgcc-latest
- resolves to the default gcc on a given systemclang
orclang-latest
- resolves to the default clang on a given system- other values - depending on selected OS, see sections below.
Exceptions:
- on MacOS, each
gcc
must have specified version, thuslatest
,gcc
,gcc-latest
are not allowed - on MacOS,
clang
versions are not supported
The available compilers are specific to the selected operating system.
You can check available versions here:
- Linux (Ubuntu)
- Windows
- MacOs
- gcc - https://formulae.brew.sh/formula/gcc
- clang - https://formulae.brew.sh/formula/llvm (currently clang will always fallback to system default version)
matrix:
os-version: [ ubuntu-latest ]
compiler: [ latest, gcc-latest, gcc-9, gcc-10, g++-11, clang, clang-10, clang-11, clang++-12 ]
matrix:
os-version: [ windows-latest ]
compiler: [ latest, gcc-latest, gcc-6.4.0, gcc-10.2.0, g++-11.2.0, clang, clang-8.0.0, clang-11.1.0, clang++-12.0.1 ]