Add caching of the installed cross binary

This commit is contained in:
Dave Rolsky
2023-07-22 09:43:41 -05:00
parent dd8fb2fac4
commit b1e766fe8f
6 changed files with 51 additions and 6 deletions

View File

@@ -44,16 +44,37 @@ runs:
with:
targets: ${{ inputs.target }}
toolchain: ${{ inputs.toolchain }}
- name: Determine latest cross version
id: determine-latest-cross-version
shell: bash
run: determine-latest-cross-version.sh
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
# We need to accesss this in both this YAML config and shell scripts. It
# doesn't seem like using ${{ env.RUNNER_TEMP }} works in the YAML config.
- name: Set directory for installing cross
id: set-cross-dir
shell: bash
run: set-cross-dir.sh
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
- name: Cache cross
id: cache-cross
uses: actions/cache@v3
with:
path: ${{ steps.set-cross-dir.outputs.cross-dir }}/cross
key: ${{ runner.os }}-${{ steps.determine-latest-cross-version.outputs.cross-version }}
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
- name: Install cross if cross-compiling (*nix)
shell: bash
run: install-cross-nix.sh
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' }}
run: install-cross-nix.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
if: ${{ steps.determine-cross-compile.outputs.needs-cross == 'true' && steps.cache-cross.outputs.cache-hit != 'true' }}
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
- name: Set build command
id: set-build-command
shell: bash
run: set-build-command.sh
run: set-build-command.sh ${{ steps.set-cross-dir.outputs.cross-dir }}
- name: Run tests (*nix)
shell: bash
run: |