|
| 1 | +name: debian |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '[0-9]+.[0-9]+.[0-9]+' |
| 9 | + pull_request: |
| 10 | + types: [opened, synchronize] |
| 11 | + |
| 12 | +jobs: |
| 13 | + |
| 14 | + debian-build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + container: |
| 17 | + image: ${{ matrix.debian-distro }} |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + debian-distro: |
| 22 | + - debian:bookworm |
| 23 | + - debian:trixie |
| 24 | + - ubuntu:24.04 |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Sync repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Define short Distribution name |
| 31 | + id: dist_short |
| 32 | + shell: bash |
| 33 | + working-directory: ${{ github.workspace }} |
| 34 | + run: | |
| 35 | + SHORT="$(echo '${{ matrix.debian-distro }}' | cut -d':' -f2)" |
| 36 | + echo "short_name=$SHORT" >> $GITHUB_OUTPUT |
| 37 | +
|
| 38 | + DISTNAME="$(echo '${{ matrix.debian-distro }}' | cut -d':' -f1)" |
| 39 | + echo "dist_name=$DISTNAME" >> $GITHUB_OUTPUT |
| 40 | +
|
| 41 | + - name: install apt packages |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + apt update |
| 45 | + apt install -y git qtbase5-dev libqt5svg5-dev libqt5websockets5-dev libqt5opengl5-dev libqt5x11extras5-dev libprotoc-dev libzmq3-dev liblz4-dev libzstd-dev ccache libmosquitto-dev ca-certificates lsb-release wget zsync |
| 46 | +
|
| 47 | + - name: Install Apache Arrow for Parquet support |
| 48 | + shell: bash |
| 49 | + run: | |
| 50 | + apt update |
| 51 | + apt install -y -V ca-certificates lsb-release wget |
| 52 | + wget https://packages.apache.org/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 53 | + apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 54 | + apt update |
| 55 | + apt install -y -V libarrow-dev # For C++ |
| 56 | + apt install -y -V libparquet-dev # For Apache Parquet C++ |
| 57 | +
|
| 58 | + - name: Prepare ccache |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + mkdir -p ${{ runner.temp }}/ccache/tmp |
| 62 | +
|
| 63 | + - name: Save ccache folder |
| 64 | + uses: actions/cache@v4 |
| 65 | + with: |
| 66 | + path: ${{ runner.temp }}/ccache |
| 67 | + key: ${{ runner.os }}-${{ steps.dist_short.outputs.short_name }} |
| 68 | + |
| 69 | + - name: Build Plotjuggler |
| 70 | + shell: bash |
| 71 | + working-directory: ${{ github.workspace }} |
| 72 | + env: |
| 73 | + CCACHE_DIR: ${{ runner.temp }}/ccache |
| 74 | + run: | |
| 75 | + cmake . -B build -DCMAKE_BUILD_TYPE=Release \ |
| 76 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 77 | + cmake --build build |
| 78 | +
|
| 79 | + - name: Define version |
| 80 | + id: define_version |
| 81 | + shell: bash |
| 82 | + working-directory: ${{ github.workspace }} |
| 83 | + run: | |
| 84 | + VERSION="0.0" |
| 85 | + if [ '${{github.ref_type}}' == 'tag' ]; then |
| 86 | + VERSION=${{github.ref_name}} |
| 87 | + fi |
| 88 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 89 | +
|
| 90 | +
|
| 91 | + - name: Build debian package |
| 92 | + shell: bash |
| 93 | + working-directory: ${{ github.workspace }} |
| 94 | + env: |
| 95 | + CCACHE_DIR: ${{ runner.temp }}/ccache |
| 96 | + run: | |
| 97 | + mkdir plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64 |
| 98 | + cp -rp DEBIAN plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/ |
| 99 | + chmod ogu+x plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/postinst |
| 100 | + chmod ogu+x plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/preinst |
| 101 | + mv plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/_control.'${{ steps.dist_short.outputs.short_name }}' plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/control |
| 102 | + rm plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/_* |
| 103 | +
|
| 104 | + if [ '${{github.ref_type}}' == 'tag' ]; then |
| 105 | + sed -i 's:0\.0:${{github.ref_name}}:g' plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/control |
| 106 | + fi |
| 107 | + cat plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/DEBIAN/control |
| 108 | + mkdir -p plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/lib/plotjuggler |
| 109 | + cp -p build/bin/* plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/lib/plotjuggler/ |
| 110 | + mkdir -p plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/bin |
| 111 | + mkdir -p plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/share/applications |
| 112 | + cp PlotJuggler.desktop plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/share/applications/ |
| 113 | + mkdir -p plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/share/icons/hicolor/512x512/apps/ |
| 114 | + cp plotjuggler.png plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/share/icons/hicolor/512x512/apps/ |
| 115 | + mkdir -p plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/share/icons/hicolor/scalable/apps/ |
| 116 | + cp plotjuggler.svg plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64/usr/share/icons/hicolor/scalable/apps/ |
| 117 | + dpkg-deb --build ./plotjuggler_'${{ steps.define_version.outputs.version }}'_amd64 |
| 118 | +
|
| 119 | + - name: Upload deb |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: plotjuggler_${{ steps.define_version.outputs.version }}_amd64_${{ steps.dist_short.outputs.short_name }}.deb |
| 123 | + path: plotjuggler_${{ steps.define_version.outputs.version }}_amd64.deb |
| 124 | + |
| 125 | + - name: Upload to Release |
| 126 | + if: startsWith(github.ref, 'refs/tags/') |
| 127 | + uses: softprops/action-gh-release@v2 |
| 128 | + with: |
| 129 | + files: plotjuggler_${{ steps.define_version.outputs.version }}_amd64_${{ steps.dist_short.outputs.short_name }}.deb |
| 130 | + generate_release_notes: true |
0 commit comments