Skip to content

Commit

Permalink
CI: Cache build outputs of libraries (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
mityu authored Sep 19, 2023
1 parent 42d6a82 commit c2ff8b6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/actions/build-submodules/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
description: 'Build submodule libraries'
inputs:
shell:
description: 'Shell to run build steps on'
required: true

runs:
using: 'composite'
steps:
- name: Get commit hash of libraries
id: lib-hash
shell: bash
run: |
echo "bullet3=$(git rev-parse HEAD:lib/bullet3)" >> $GITHUB_OUTPUT
echo "saba=$(git rev-parse HEAD:lib/saba)" >> $GITHUB_OUTPUT
- name: Pull cache of lib/bullet3 build
uses: actions/cache@v3
id: cache-bullet3
with:
path: lib/bullet3
key: bullet3-${{ steps.lib-hash.outputs.bullet3 }}-${{ runner.os }}
- name: Build bullet3
if: steps.cache-bullet3.outputs.cache-hit != 'true'
shell: ${{ inputs.shell }}
run: make build-bullet
- name: Pull cache of lib/saba build
uses: actions/cache@v3
id: cache-saba
with:
path: lib/saba
key: saba-${{ steps.lib-hash.outputs.saba }}-${{ runner.os }}
- name: Build saba
if: steps.cache-saba.outputs.cache-hit != 'true'
shell: ${{ inputs.shell }}
run: make build-saba
6 changes: 5 additions & 1 deletion .github/workflows/release-prebuild-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ jobs:
if: steps.check.outputs.skip == 'no'
run:
git submodule update --init --recursive --recommend-shallow --depth 1
- name: Build submodule libraries
if: steps.check.outputs.skip == 'no'
uses: ./.github/actions/build-submodules
with:
shell: msys2 {0}
- name: Build binary
if: steps.check.outputs.skip == 'no'
run: |
make build-submodule
make release -j
- name: Package
if: steps.check.outputs.skip == 'no'
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ jobs:
run: |
uname -a
g++ --version
- name: Build submodules
uses: ./.github/actions/build-submodules/
with:
shell: msys2 {0}
- name: Try build on Windows
run: |
make build-submodule
make -j
macos:
runs-on: macos-latest
Expand All @@ -42,8 +45,11 @@ jobs:
run: |
uname -a
clang++ --version
- name: Build submodules
uses: ./.github/actions/build-submodules/
with:
shell: bash
- name: Try build on macOS
run: |
make build-submodule
make -j
make app

0 comments on commit c2ff8b6

Please sign in to comment.