Skip to content

C/C++ CI and Release #21

C/C++ CI and Release

C/C++ CI and Release #21

name: C/C++ CI and Release
on:
push:
tags:
- 'v*.*.*' # Trigger only on tags like v1.0.0
workflow_dispatch: # Allow manual runs if needed
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.os == 'macos-latest' }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
extension: .out
compiler: g++
- os: windows-latest
extension: .exe
compiler: mingw-g++
- os: macos-latest
extension: .out
compiler: clang++
steps:
- uses: actions/checkout@v4
# Set up MSYS2 environment and install MinGW on Windows
- name: Set up MSYS2 with MinGW
if: ${{ matrix.os == 'windows-latest' }}
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: mingw-w64-x86_64-gcc
# Add MinGW to PATH on Windows
- name: Add MinGW to PATH
if: ${{ matrix.os == 'windows-latest' }}
run: echo "C:/msys64/mingw64/bin" >> $GITHUB_PATH
- name: Tree
if: ${{ matrix.os == 'windows-latest' }}
run: tree C:\msys64\mingw64\bin
# Build step - uses appropriate compiler based on OS
- name: Build Project
run: |
if [ "${{ matrix.compiler }}" == "mingw-g++" ]; then
mingw-w64-x86_64-g++ -std=c++2a -I./src ./XanaduCLI/XanaduCLI.cpp ./src/XanaduXVD.cpp ./src/XVDTypes.cpp -o XanaduCLI${{ matrix.extension }}
else
${{ matrix.compiler }} -I./src ./XanaduCLI/XanaduCLI.cpp ./src/XanaduXVD.cpp ./src/XVDTypes.cpp -o XanaduCLI${{ matrix.extension }}
fi
shell: bash