|
| 1 | +name: C++ CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, macos-latest] # TO-DO: Add back windows-latest when the project is tested on a Windows machine. |
| 15 | + fail-fast: false |
| 16 | + |
| 17 | + continue-on-error: true |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + # Set up Python 3.10 or later |
| 23 | + - name: Set up Python 3.10 (Windows) |
| 24 | + if: matrix.os == 'windows-latest' |
| 25 | + uses: actions/setup-python@v2 |
| 26 | + with: |
| 27 | + python-version: '3.10' |
| 28 | + |
| 29 | + # Install C++ Compiler & Build Tools |
| 30 | + - name: Set up C++ environment (Ubuntu) |
| 31 | + if: matrix.os == 'ubuntu-latest' |
| 32 | + run: | |
| 33 | + sudo apt-get update |
| 34 | + sudo apt-get install -y g++ make cmake |
| 35 | + g++ --version |
| 36 | + cmake --version |
| 37 | + make --version |
| 38 | +
|
| 39 | + - name: Set up C++ environment (macOS) |
| 40 | + if: matrix.os == 'macos-latest' |
| 41 | + run: | |
| 42 | + brew install make cmake |
| 43 | + echo 'export PATH="/usr/local/opt/gcc/bin:$PATH"' >> ~/.bash_profile |
| 44 | + source ~/.bash_profile |
| 45 | + g++ --version |
| 46 | + cmake --version |
| 47 | + make --version |
| 48 | +
|
| 49 | + - name: Set up C++ environment (Windows) |
| 50 | + if: matrix.os == 'windows-latest' |
| 51 | + run: | |
| 52 | + choco install mingw --version=8.1.0-1 |
| 53 | + choco install make cmake |
| 54 | + echo C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 55 | + echo C:\ProgramData\chocolatey\lib\cmake\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 56 | + g++ --version |
| 57 | + cmake --version |
| 58 | + make --version |
| 59 | +
|
| 60 | + # Install Qt6 |
| 61 | + - name: Install Qt6 (Ubuntu) |
| 62 | + if: matrix.os == 'ubuntu-latest' |
| 63 | + run: | |
| 64 | + sudo apt-get install -y qt6-base-dev |
| 65 | + echo 'export PATH="/usr/lib/qt6/bin:$PATH"' >> ~/.bashrc |
| 66 | + source ~/.bashrc |
| 67 | +
|
| 68 | + - name: Install Qt6 (macOS) |
| 69 | + if: matrix.os == 'macos-latest' |
| 70 | + run: | |
| 71 | + brew install qt6 |
| 72 | + echo 'export PATH="/opt/homebrew/opt/qt6/bin:$PATH"' >> ~/.bash_profile |
| 73 | + source ~/.bash_profile |
| 74 | +
|
| 75 | + - name: Install Qt6 (Windows) |
| 76 | + if: matrix.os == 'windows-latest' |
| 77 | + run: | |
| 78 | + python -m pip install aqtinstall |
| 79 | + python -m aqt install-qt windows desktop 6.6.0 win64_mingw --outputdir C:\Qt |
| 80 | + echo C:\Qt\6.6.0\mingw_64\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 81 | +
|
| 82 | + # Build the Project |
| 83 | + - name: Build project |
| 84 | + run: make build |
| 85 | + |
| 86 | + # Install the Project with desktop shortcut |
| 87 | + - name: Install project (Mac/Windows) |
| 88 | + if: matrix.os != 'ubuntu-latest' |
| 89 | + run: | |
| 90 | + cd ${{ github.workspace }} |
| 91 | + echo "y" | make install |
| 92 | +
|
| 93 | + # Install the Project without desktop shortcut (Linux) |
| 94 | + # This is a work around for Linux shortcut bug |
| 95 | + - name: Install project (Linux) |
| 96 | + if: matrix.os == 'ubuntu-latest' |
| 97 | + run: echo "n" | make install |
0 commit comments