diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f40472f..fbd848cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,19 +3,25 @@ name: C/C++ and Bazel CI on: [push, pull_request] # Not using 'inputs' here, since we take no inputs at this time -- just the 'github' context. -run-name: Run CI with ${{ github.ref_name }} by @${{ github.actor }} +# Note: on type workflow_run commit message would be github.event.workflow_run.head_commit.message +# https://stackoverflow.com/a/63619526 +# Available data: https://stackoverflow.com/a/75715955 +run-name: "@{{github.actor}} CI on ${{ github.ref_name }} - ${{ github.event.head_commit.message }}" jobs: + cpp: runs-on: ubuntu-latest + # needs: [jobs, we, want, to, run, first] steps: - - uses: actions/checkout@v1 - #- name: Checkout submodules - # uses: textbook/git-checkout-submodule-action@2.0.0 - - name: Checkout submodules - run: git submodule init && git submodule update - - name: install deps + # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for + # the rest of the steps + - uses: actions/checkout@v4 + with: + submodules: true + + - name: install deps with prebuilt SDL (no bazel) run: sudo apt-get update && sudo apt-get install libsdl1.2-dev libsdl-gfx1.2-dev libgmp3-dev autoconf automake libgl1-mesa-dev libglu1-mesa-dev - name: install glict run: cd vendor/github.com/ivucica/glict/glict && ./autogen.sh && ./configure && make && sudo make install @@ -30,13 +36,15 @@ jobs: #- name: make distcheck # run: make distcheck - bazel: + bazel_build: runs-on: ubuntu-latest steps: # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for # the rest of the steps - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 + with: + submodules: true # Caches and restores the bazel build directory. - name: Cache bazel build results @@ -60,23 +68,58 @@ jobs: run: echo Stub action merely printing a notice that there was a cache miss # More useful with e.g. npm. - - name: Checkout submodules - run: git submodule init && git submodule update - - name: install deps + - name: install deps without prebuilt SDL (bazel) run: sudo apt-get update && sudo apt-get install autoconf automake libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libasound-dev libalsaplayer-dev - name: bazel build run: bazel build //:yatc + + bazel_test: + runs-on: ubuntu-latest + + needs: [bazel_build] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for + # the rest of the steps + - uses: actions/checkout@v4 + with: + submodules: true + + # Caches and restores the bazel build directory. + - name: Cache bazel build results + uses: actions/cache@v3 + env: + cache-name: bazel-cache + with: + path: ~/.cache/bazel + key: bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }} + restore-keys: | + bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }} + bazel-${{ runner.os }}-${{ env.cache-name }}-master + bazel-${{ runner.os }}-${{ env.cache-name }}- + bazel-${{ runner.os }}- + ${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }} + ${{ runner.os }}-${{ env.cache-name }}-master + + - if: ${{ steps.bazel-cache.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: echo Stub action merely printing a notice that there was a cache miss + # More useful with e.g. npm. + + - name: install deps without prebuilt SDL (bazel) + run: sudo apt-get update && sudo apt-get install autoconf automake libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libasound-dev libalsaplayer-dev - name: bazel test run: bazel test //:util_test - bazel-buildbuddy: + bazel_build_buildbuddy: runs-on: ubuntu-latest steps: # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for # the rest of the steps - - uses: actions/checkout@v1 - + - uses: actions/checkout@v4 + with: + submodules: true # Caches and restores the bazel build directory. - name: Cache bazel build results uses: actions/cache@v3 @@ -99,9 +142,41 @@ jobs: run: echo Stub action merely printing a notice that there was a cache miss # More useful with e.g. npm. - - name: Checkout submodules - run: git submodule init && git submodule update - name: rbe bazel build run: bazel build --config=remote //:yatc + + bazel_test_buildbuddy: + runs-on: ubuntu-latest + + needs: [bazel_build_buildbuddy] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, which is the CWD for + # the rest of the steps + - uses: actions/checkout@v4 + with: + submodules: true + + # Caches and restores the bazel build directory. + - name: Cache bazel build results + uses: actions/cache@v3 + env: + cache-name: bazel-cache + with: + path: ~/.cache/bazel + key: bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }} + restore-keys: | + bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }} + bazel-${{ runner.os }}-${{ env.cache-name }}-master + bazel-${{ runner.os }}-${{ env.cache-name }}- + bazel-${{ runner.os }}- + ${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }} + ${{ runner.os }}-${{ env.cache-name }}-master + + - if: ${{ steps.bazel-cache.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: echo Stub action merely printing a notice that there was a cache miss + # More useful with e.g. npm. + - name: rbe bazel test run: bazel test --config=remote //:util_test