|
| 1 | +name: build |
| 2 | +on: [push, pull_request] |
| 3 | +jobs: |
| 4 | + build: |
| 5 | + name: "${{ matrix.id }}" |
| 6 | + runs-on: ubuntu-latest |
| 7 | + container: ${{ matrix.container }} |
| 8 | + timeout-minutes: 360 |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - id: "coverage-debian-stable-amd64-gcc" |
| 14 | + task: "coverage" |
| 15 | + configure-args: "--enable-ja-rule --enable-e133 --enable-unittests --enable-gcov" |
| 16 | + # TODO(Perry): Fix Debian 12 OOM issue on GitHub Actions |
| 17 | + container: "debian:stable" |
| 18 | + compiler: |
| 19 | + CC: "/usr/bin/gcc" |
| 20 | + CXX: "/usr/bin/g++" |
| 21 | + pkg: "gcc g++" |
| 22 | + - id: "distcheck-debian-stable-amd64-gcc" |
| 23 | + task: "distcheck" |
| 24 | + configure-args: "--enable-ja-rule --enable-e133 --enable-rdm-tests --enable-java-libs" |
| 25 | + # TODO(Perry): Fix Debian 12 OOM issue on GitHub Actions |
| 26 | + container: "debian:stable" |
| 27 | + compiler: |
| 28 | + CC: "/usr/bin/gcc" |
| 29 | + CXX: "/usr/bin/g++" |
| 30 | + pkg: "gcc g++" |
| 31 | + - id: "distcheck-debian-stable-amd64-clang" |
| 32 | + task: "distcheck" |
| 33 | + configure-args: "--enable-ja-rule --enable-e133 --enable-rdm-tests --enable-java-libs" |
| 34 | + # TODO(Perry): Fix Debian 12 OOM issue on GitHub Actions |
| 35 | + container: "debian:stable" |
| 36 | + compiler: |
| 37 | + CC: "/usr/bin/clang" |
| 38 | + CXX: "/usr/bin/clang++" |
| 39 | + pkg: "clang" |
| 40 | + env: |
| 41 | + CC: "${{ matrix.compiler.CC }}" |
| 42 | + CXX: "${{ matrix.compiler.CXX }}" |
| 43 | + steps: |
| 44 | + - name: Get number of CPU cores |
| 45 | + id: num-cpu-cores |
| 46 | + # TODO(Perry): Parallelization causes GH Actions to hang -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} |
| 47 | + # run: echo "NUM_CPU_CORES=$(grep -c processor /proc/cpuinfo)" >> $GITHUB_OUTPUT |
| 48 | + run: echo "NUM_CPU_CORES=1" >> $GITHUB_OUTPUT |
| 49 | + - name: Update package database |
| 50 | + run: apt-get update -y |
| 51 | + # See comments beginning at |
| 52 | + # https://github.com/actions/runner/issues/763#issuecomment-1435474884 |
| 53 | + # Without Git, actions/checkout@v3 will resort to REST and will not |
| 54 | + # create a .git folder or .git.config. The Problem Matcher looks for |
| 55 | + # .git/config to find where the root of the repo is, so it must be |
| 56 | + # present. |
| 57 | + - name: Install Git |
| 58 | + run: apt-get -y install git |
| 59 | + - uses: actions/checkout@v3 |
| 60 | + - name: Install build tools |
| 61 | + shell: bash |
| 62 | + run: | |
| 63 | + apt-get -y install adduser sudo pkg-config libtool autoconf \ |
| 64 | + automake g++ bison flex make bash-completion dh-autoreconf \ |
| 65 | + debhelper devscripts wget python3-full python3-pip |
| 66 | + - name: Setup Python venv |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + python3 -m venv --system-site-packages ../venv |
| 70 | + source ../venv/bin/activate |
| 71 | + echo "PATH=$PATH" >> $GITHUB_ENV |
| 72 | + - name: Install Python build tools |
| 73 | + run: python3 -m pip install --no-input gcovr |
| 74 | + - name: Install build dependencies |
| 75 | + shell: bash |
| 76 | + run: | |
| 77 | + apt-get -y install libcppunit-dev uuid-dev libncurses5-dev \ |
| 78 | + libmicrohttpd-dev protobuf-compiler python3-protobuf \ |
| 79 | + libprotobuf-dev libprotoc-dev zlib1g-dev libftdi-dev \ |
| 80 | + libusb-1.0-0-dev liblo-dev libavahi-client-dev python3-numpy \ |
| 81 | + default-jdk-headless maven |
| 82 | + - name: Install compiler |
| 83 | + shell: bash |
| 84 | + run: apt-get -y install ${{ matrix.compiler.pkg }} |
| 85 | + - name: Set up build user # CredentialsTest cannot run as root |
| 86 | + run: | |
| 87 | + adduser --disabled-password --gecos "" builduser |
| 88 | + chown -R builduser:builduser . |
| 89 | + chown builduser:builduser .. |
| 90 | + - name: Autoreconf |
| 91 | + run: sudo --preserve-env -u builduser env "PATH=$PATH" autoreconf -i |
| 92 | + - name: Set configure arguments |
| 93 | + run: | |
| 94 | + echo "GH_OLA_CONFIGURE_ARGS=${{ matrix.configure-args }}" >> $GITHUB_ENV |
| 95 | + - name: Set additional Linux configure arguments |
| 96 | + if: runner.os == 'Linux' |
| 97 | + # Silence all deprecated declarations on Linux due to auto_ptr making the build log too long |
| 98 | + run: | |
| 99 | + echo "GH_OLA_CONFIGURE_ARGS=$GH_OLA_CONFIGURE_ARGS CPPFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV |
| 100 | + - name: Print configure command |
| 101 | + run: echo "./configure $GH_OLA_CONFIGURE_ARGS" |
| 102 | + - name: Configure |
| 103 | + run: sudo --preserve-env -u builduser env "PATH=$PATH" ./configure $GH_OLA_CONFIGURE_ARGS |
| 104 | + - name: ${{ matrix.task }} |
| 105 | + run: sudo --preserve-env -u builduser env "PATH=$PATH" make ${{ matrix.task }} -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} VERBOSE=1 |
| 106 | + - name: Display structure of the built files |
| 107 | + if: always() && env.ACTIONS_STEP_DEBUG == 'true' |
| 108 | + run: ls -alR |
| 109 | + - name: Archive artifacts to speed up slow GH Actions upload/download |
| 110 | + if: always() |
| 111 | + shell: bash |
| 112 | + # If the file does not exist when tar excludes it, then it will not |
| 113 | + # actually exclude it, so it must first be touched |
| 114 | + run: | |
| 115 | + touch ola-${{ matrix.id }}-source-tree.tar.gz |
| 116 | + tar --exclude=ola-${{ matrix.id }}-source-tree.tar.gz -cvzf ola-${{ matrix.id }}-source-tree.tar.gz . |
| 117 | + - name: SHA256 artifact archives |
| 118 | + if: always() |
| 119 | + run: sha256sum ola-*.tar.gz |
| 120 | + - name: Upload source tree artifact |
| 121 | + uses: actions/upload-artifact@v3 |
| 122 | + if: always() |
| 123 | + with: |
| 124 | + name: ola-${{ matrix.id }}-source-tree |
| 125 | + path: ola-${{ matrix.id }}-source-tree.tar.gz |
| 126 | + - name: Upload built artifact |
| 127 | + if: matrix.task == 'distcheck' || matrix.task == 'dist' |
| 128 | + uses: actions/upload-artifact@v3 |
| 129 | + with: |
| 130 | + name: ola-${{ matrix.id }}-dist |
| 131 | + path: | |
| 132 | + ola-*.tar.gz |
| 133 | + !ola-${{ matrix.id }}-source-tree.tar.gz |
| 134 | + - name: Install coverage tools |
| 135 | + if: matrix.task == 'coverage' |
| 136 | + run: apt-get -y install curl |
| 137 | + - name: Upload coverage to Coveralls |
| 138 | + if: matrix.task == 'coverage' |
| 139 | + uses: coverallsapp/github-action@v2 |
| 140 | + with: |
| 141 | + # Coveralls GitHub action does not support its own format |
| 142 | + # see: https://github.com/coverallsapp/github-action/issues/104 |
| 143 | + # file: coverage/coverage.coveralls.json |
| 144 | + file: coverage/coverage.cobertura.xml |
| 145 | + format: cobertura |
| 146 | + flag-name: ${{ matrix.id }} |
| 147 | + - name: Upload coverage artifacts |
| 148 | + if: always() && matrix.task == 'coverage' |
| 149 | + uses: actions/upload-artifact@v3 |
| 150 | + with: |
| 151 | + name: ola-${{ matrix.id }}-coverage |
| 152 | + path: coverage/ |
| 153 | + verify-trees: |
| 154 | + name: 'Verify trees for ${{ matrix.id }}' |
| 155 | + needs: build |
| 156 | + if: "always()" # Run if some builds fail but ensure they all complete first |
| 157 | + container: debian:stable |
| 158 | + runs-on: ubuntu-latest |
| 159 | + strategy: |
| 160 | + fail-fast: false |
| 161 | + matrix: |
| 162 | + include: |
| 163 | + - id: "distcheck-debian-stable-amd64-gcc" |
| 164 | + - id: "distcheck-debian-stable-amd64-clang" |
| 165 | + steps: |
| 166 | + - name: Download built source tree archive |
| 167 | + uses: actions/download-artifact@v3 |
| 168 | + with: |
| 169 | + name: ola-${{ matrix.id }}-source-tree |
| 170 | + path: . |
| 171 | + - name: SHA256 artifact archive |
| 172 | + run: sha256sum ola-${{ matrix.id }}-source-tree.tar.gz |
| 173 | + - name: Unarchive artifacts and delete archive |
| 174 | + shell: bash |
| 175 | + run: | |
| 176 | + tar -xvzf ola-${{ matrix.id }}-source-tree.tar.gz . |
| 177 | + rm ola-${{ matrix.id }}-source-tree.tar.gz |
| 178 | + - name: Display structure of extracted files |
| 179 | + if: env.ACTIONS_STEP_DEBUG == 'true' |
| 180 | + run: ls -alR |
| 181 | + - name: Update package database |
| 182 | + run: apt-get update -y |
| 183 | + - name: Install Python |
| 184 | + run: apt-get -y install python3 python-is-python3 |
| 185 | + # TODO(Perry): Disable problem matcher for now until verify trees is fixed |
| 186 | + # - name: Enable Problem Matcher for GitHub annotations |
| 187 | + # run: echo "::add-matcher::.github/problem-matcher-build-verify-trees.json" |
| 188 | + - name: Find dist build tarball |
| 189 | + run: | |
| 190 | + echo "GH_OLA_VERIFY_TREES_TARBALL=$(ls -t --time=birth ola*.tar.gz| head -1)" >> $GITHUB_ENV |
| 191 | + - name: Print dist build tarball name |
| 192 | + run: echo "$GH_OLA_VERIFY_TREES_TARBALL" |
| 193 | + - name: Extract dist build |
| 194 | + run: tar -xvzf $GH_OLA_VERIFY_TREES_TARBALL |
| 195 | + - name: Verify trees |
| 196 | + shell: bash |
| 197 | + # TODO(Perry): Always succeed for now until verify trees is fixed |
| 198 | + # run: ./scripts/verify_trees.py ./ $(echo $GH_OLA_VERIFY_TREES_TARBALL | sed 's/.tar.gz$//') |
| 199 | + run: "./scripts/verify_trees.py ./ $(echo $GH_OLA_VERIFY_TREES_TARBALL | sed 's/.tar.gz$//') || true" |
0 commit comments