diff options
Diffstat (limited to 'contrib/SDL-3.2.8/.github/actions/setup-ninja/action.yml')
| -rw-r--r-- | contrib/SDL-3.2.8/.github/actions/setup-ninja/action.yml | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/.github/actions/setup-ninja/action.yml b/contrib/SDL-3.2.8/.github/actions/setup-ninja/action.yml new file mode 100644 index 0000000..a1d3ad9 --- /dev/null +++ b/contrib/SDL-3.2.8/.github/actions/setup-ninja/action.yml | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | name: 'Setup ninja' | ||
| 2 | description: 'Download ninja and add it to the PATH environment variable' | ||
| 3 | inputs: | ||
| 4 | version: | ||
| 5 | description: 'Ninja version' | ||
| 6 | default: '1.12.1' | ||
| 7 | runs: | ||
| 8 | using: 'composite' | ||
| 9 | steps: | ||
| 10 | - name: 'Calculate variables' | ||
| 11 | id: calc | ||
| 12 | shell: sh | ||
| 13 | run: | | ||
| 14 | case "${{ runner.os }}-${{ runner.arch }}" in | ||
| 15 | "Linux-X86" | "Linux-X64") | ||
| 16 | archive="ninja-linux.zip" | ||
| 17 | ;; | ||
| 18 | "Linux-ARM64") | ||
| 19 | archive="ninja-linux-aarch64.zip" | ||
| 20 | ;; | ||
| 21 | "macOS-X86" | "macOS-X64" | "macOS-ARM64") | ||
| 22 | archive="ninja-mac.zip" | ||
| 23 | ;; | ||
| 24 | "Windows-X86" | "Windows-X64") | ||
| 25 | archive="ninja-win.zip" | ||
| 26 | ;; | ||
| 27 | "Windows-ARM64") | ||
| 28 | archive="ninja-winarm64.zip" | ||
| 29 | ;; | ||
| 30 | *) | ||
| 31 | echo "Unsupported ${{ runner.os }}-${{ runner.arch }}" | ||
| 32 | exit 1; | ||
| 33 | ;; | ||
| 34 | esac | ||
| 35 | echo "archive=${archive}" >> ${GITHUB_OUTPUT} | ||
| 36 | echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT} | ||
| 37 | - name: 'Restore cached ${{ steps.calc.outputs.archive }}' | ||
| 38 | id: cache-restore | ||
| 39 | uses: actions/cache/restore@v4 | ||
| 40 | with: | ||
| 41 | path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' | ||
| 42 | key: ${{ steps.calc.outputs.cache-key }} | ||
| 43 | - name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})' | ||
| 44 | if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }} | ||
| 45 | shell: pwsh | ||
| 46 | run: | | ||
| 47 | Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" | ||
| 48 | - name: 'Cache ${{ steps.calc.outputs.archive }}' | ||
| 49 | if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }} | ||
| 50 | uses: actions/cache/save@v4 | ||
| 51 | with: | ||
| 52 | path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}' | ||
| 53 | key: ${{ steps.calc.outputs.cache-key }} | ||
| 54 | - name: 'Extract ninja' | ||
| 55 | shell: pwsh | ||
| 56 | run: | | ||
| 57 | 7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}" | ||
| 58 | - name: 'Set output variables' | ||
| 59 | id: final | ||
| 60 | shell: pwsh | ||
| 61 | run: | | ||
| 62 | echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH | ||
