|
| 1 | +# include this file in the cicd_windows.yaml, cicd_ubuntu.yaml, and cicd_macos.yaml like this: |
| 2 | +# - name: Install Lazarus IDE |
| 3 | +# uses: ./.github/actions/install_lazarus |
| 4 | +# with: |
| 5 | +# qt_version_ci: 6 # optional, only needed when building with qt5 or qt6 |
| 6 | + |
| 7 | + |
| 8 | +# https://docs.github.com/en/actions/tutorials/create-actions/create-a-composite-action |
| 9 | +name: 'Install Lazaurus IDE' |
| 10 | +description: 'download and build lazbuild' |
| 11 | + |
| 12 | +inputs: |
| 13 | + qt_version_ci: # id of input |
| 14 | + description: 'QT version' |
| 15 | + required: false |
| 16 | + |
| 17 | +runs: |
| 18 | + using: "composite" |
| 19 | + steps: |
| 20 | + - name: Install Lazarus IDE (Windows) |
| 21 | + if: runner.os == 'Windows' |
| 22 | + run: winget install lazarus --disable-interactivity --accept-source-agreements --silent |
| 23 | + shell: powershell |
| 24 | + |
| 25 | + - name: Install fpc (Linux) |
| 26 | + if: runner.os == 'Linux' |
| 27 | + run: | |
| 28 | + sudo apt-get update |
| 29 | + sudo apt-get install -y fpc |
| 30 | + shell: bash |
| 31 | + |
| 32 | + - name: Install dependency for gtk2 |
| 33 | + if: runner.os == 'Linux' && inputs.qt_version_ci == '' |
| 34 | + run: sudo apt-get install -y libgtk2.0-dev |
| 35 | + shell: bash |
| 36 | + |
| 37 | + - name: Install dependency for qt5 |
| 38 | + if: runner.os == 'Linux' && inputs.qt_version_ci == '5' |
| 39 | + run: sudo apt-get install -y libqt5x11extras5-dev |
| 40 | + shell: bash |
| 41 | + |
| 42 | + - name: Install dependency for qt6 |
| 43 | + if: runner.os == 'Linux' && inputs.qt_version_ci == '6' |
| 44 | + run: sudo apt-get install -y qt6-base-dev |
| 45 | + shell: bash |
| 46 | + |
| 47 | + - name: Install Free Pascal Compiler (FPC) multi arch version for macOS x86_64 and aarch64 (macOS) |
| 48 | + if: runner.os == 'macOS' |
| 49 | + run: brew install fpc |
| 50 | + shell: bash |
| 51 | + |
| 52 | + - name: Download Lazarus source code into temp folder (Linux and macOS) |
| 53 | + if: runner.os != 'Windows' |
| 54 | + env: |
| 55 | + # Linux and macOS need to build lazbuild from Lazarus source code. |
| 56 | + # Copied the latest Lazarus source code from: https://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/ |
| 57 | + LAZARUS_URL_TAR_GZ: "https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/lazarus.tar.gz" |
| 58 | + RUNNER_TEMP: ${{ runner.temp }} |
| 59 | + run: | |
| 60 | + #Download lazarus source code. Directory 'lazarus' will be created in the temp folder. |
| 61 | + echo ${RUNNER_TEMP} |
| 62 | + cd ${RUNNER_TEMP} |
| 63 | + curl -L -O ${{ env.LAZARUS_URL_TAR_GZ }} |
| 64 | + tar -xzf *.tar.gz |
| 65 | + shell: bash |
| 66 | + |
| 67 | + - name: Build lazbuild from Lazarus source code (Linux and macOS) |
| 68 | + if: runner.os != 'Windows' |
| 69 | + env: |
| 70 | + RUNNER_TEMP: ${{ runner.temp }} |
| 71 | + run: | |
| 72 | + # make lazbuild and put the link with extra parameter in the temp folder. |
| 73 | + LAZARUS_DIR=${RUNNER_TEMP}/lazarus |
| 74 | + cd "$LAZARUS_DIR" |
| 75 | + make lazbuild |
| 76 | + echo "$LAZARUS_DIR/lazbuild --primary-config-path=$LAZARUS_DIR --lazarusdir=$LAZARUS_DIR \$*" > ${RUNNER_TEMP}/lazbuild |
| 77 | + chmod +x ${RUNNER_TEMP}/lazbuild |
| 78 | + # Add lazbuild to the PATH variable. |
| 79 | + echo ${RUNNER_TEMP} >> $GITHUB_PATH |
| 80 | + shell: bash |
| 81 | + |
| 82 | + - name: Build libQTpas.so (qt5 or qt6) |
| 83 | + if: runner.os == 'Linux' && inputs.qt_version_ci != '' |
| 84 | + env: |
| 85 | + RUNNER_TEMP: ${{ runner.temp }} |
| 86 | + run: | |
| 87 | + cd "${RUNNER_TEMP}/lazarus/lcl/interfaces/qt${{ inputs.qt_version_ci }}/cbindings/" |
| 88 | + /usr/lib/qt${{ inputs.qt_version_ci }}/bin/qmake |
| 89 | + make -j$(nproc) |
| 90 | + sudo make install |
| 91 | + shell: bash |
| 92 | + |
| 93 | + |
0 commit comments