|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + # Run anytime a new commit is pushed to main. |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | + # Run on every PR that is opened against main. |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | + # Run on a schedule (daily @ 6am Eastern time). |
| 13 | + schedule: |
| 14 | + - cron: "0 11 * * *" |
| 15 | + |
| 16 | + # Enable manually triggering jobs. |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +# If someone pushes a new commit to a branch, ensure that only the latest commit |
| 20 | +# is built to avoid wasting runner minutes. Treat "main" as an exception, |
| 21 | +# probably best to test all commits to it. |
| 22 | +concurrency: |
| 23 | + group: ${{ github.ref }} |
| 24 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 25 | + |
| 26 | +# We can have multiple jobs. Jobs run in parallel unless they explicitly declare |
| 27 | +# dependencies on other jobs. |
| 28 | +jobs: |
| 29 | + build_ubuntu: |
| 30 | + # This is the name of the check as it will appear on the PR. |
| 31 | + name: Build [${{ matrix.os }}] [${{ matrix.compiler }}] |
| 32 | + |
| 33 | + # TODO: When we want to make a job failure block a PR, we must set |
| 34 | + # "continue-on-error" to "false" or omit it, *and* mark the check as |
| 35 | + # required under branch protection rules. |
| 36 | + continue-on-error: true |
| 37 | + |
| 38 | + # Strategies can be used to run the same job with different configurations. |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: [ubuntu-latest] |
| 42 | + compiler: [gcc, clang] |
| 43 | + include: |
| 44 | + - compiler: gcc |
| 45 | + cc: gcc |
| 46 | + cxx: g++ |
| 47 | + - compiler: clang |
| 48 | + cc: clang |
| 49 | + cxx: clang++ |
| 50 | + |
| 51 | + # These environment variables will be set for every step in the job. |
| 52 | + env: |
| 53 | + # Tell CMake to configure the build system with the desired compilers for |
| 54 | + # the current job configuration selected from the matrix. |
| 55 | + CC: ${{ matrix.cc }} |
| 56 | + CXX: ${{ matrix.cxx }} |
| 57 | + |
| 58 | + # This specifies the "runner" to use for this job. Runners can be either |
| 59 | + # GitHub-hosted or self-hosted. All repos in the `bloomberg` org that use |
| 60 | + # Actions use GitHub-hosted runners. See the GitHub docs for how runner time |
| 61 | + # is billed: https://docs.github.com/en/billing/concepts/product-billing/github-actions. |
| 62 | + runs-on: ${{ matrix.os }} |
| 63 | + |
| 64 | + defaults: |
| 65 | + run: |
| 66 | + # Make sure to fail any "run" step early on so that steps don't silently |
| 67 | + # pass even when errors may have occurred. |
| 68 | + shell: bash -o errexit -o nounset -o pipefail {0} |
| 69 | + |
| 70 | + # Steps in a job are executed serially. |
| 71 | + steps: |
| 72 | + # "actions/checkout" is an official action supported by GitHub. |
| 73 | + - name: Checkout code |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + # In addition to using official and community actions, we can run our own |
| 77 | + # shell scripts. If the last executed process in a "run" step ends with a |
| 78 | + # non-zero exit code, the step fails. |
| 79 | + # |
| 80 | + # Note: gcc and clang are pre-installed on Ubuntu runners. |
| 81 | + - name: Install dependencies |
| 82 | + run: | |
| 83 | + sudo apt-get install -y \ |
| 84 | + bison \ |
| 85 | + build-essential \ |
| 86 | + cmake \ |
| 87 | + flex \ |
| 88 | + libevent-dev \ |
| 89 | + liblz4-dev \ |
| 90 | + libprotobuf-c-dev \ |
| 91 | + libreadline-dev \ |
| 92 | + libsqlite3-dev \ |
| 93 | + libssl-dev \ |
| 94 | + libunwind-dev \ |
| 95 | + ncurses-dev \ |
| 96 | + protobuf-c-compiler \ |
| 97 | + tcl \ |
| 98 | + uuid-dev \ |
| 99 | + zlib1g-dev |
| 100 | +
|
| 101 | + - name: Generate build system |
| 102 | + run: | |
| 103 | + mkdir -p build |
| 104 | + cd build |
| 105 | +
|
| 106 | + echo "Running CMake" |
| 107 | + cmake .. |
| 108 | +
|
| 109 | + - name: Build [all] |
| 110 | + working-directory: build |
| 111 | + run: | |
| 112 | + make -j $(nproc) |
| 113 | +
|
| 114 | + - name: Build [test-tools] |
| 115 | + working-directory: build |
| 116 | + run: | |
| 117 | + make -j $(nproc) test-tools |
0 commit comments