Skip to content

Commit

Permalink
Install ninja binary directly from its repository
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Apr 26, 2024
1 parent 3e85fb0 commit 0ceb5f1
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019]
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, macos-13, macos-14, windows-2019, windows-2022]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get Ninja
id: ninja
Expand Down
9 changes: 3 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ runs:
using: "composite"
steps:
- name: Install on Mac/Linux/Windows
run: |
pip3 install wheel setuptools
pip3 install ninja --upgrade
run: bash $GITHUB_ACTION_PATH/install-ninja.sh
shell: bash
- name: Fix path on Linux
run: |
echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Fix path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Fill in output variable
id: output_version
Expand Down
5 changes: 5 additions & 0 deletions checksums.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
daa94231f55bf32a46b1b45e3a0dc767f73483a681d3277923833df9ac4f12532d67e9aca2f45768f31c8b3b8e63149d69867cb0a0e6c48683f197bf2634d681 ninja-linux-aarch64.zip
a6d4c8410cc7cd0eced47518b8deca90af9e6f9b1e9fba992bcc5bc92645d07e20bd005a59c90c4c24cded68a4f2178f3a2043707e578e326881ffdaae073f2f ninja-linux.zip
cb271573df79c36a61bf6f63ff7aca7e2e7e3764c1ef0ce8e6f4667dae54326f905061cf56f19aea37625c94eeb96abc8f643b14d0e65da70e2e6cf9d127a52a ninja-win.zip
23726030fa0ffd05afef6cf75042ad7518fb954af058f85a8a3fdab4e8d157ef42347b6232d20c1a609e91d9c38ebfd2f1cdc751ca6eb1f87e333cc6971455a5 ninja-mac.zip
35b9228d91c133eabf8318b0842d6621be7b11ffaa46bfc3cf0cfe9aa5858c2db7b5dc7c475444f0da8cd07b35304e0c61f53cf264f258a6902c74b26438c248 ninja-winarm64.zip
47 changes: 47 additions & 0 deletions install-ninja.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /bin/bash

echo "Runner $RUNNER_OS $RUNNER_ARCH"

wget=wget
if [ "$RUNNER_OS" == "Windows" ]; then
if [ "$RUNNER_ARCH" == "ARM64" ]; then
filename=ninja-winarm64.zip
else
filename=ninja-win.zip
fi
wget=C:/msys64/usr/bin/wget.exe
checksum=sha512sum
elif [ "$RUNNER_OS" == "macOS" ]; then
filename=ninja-mac.zip
checksum="shasum -a 512"
elif [ "$RUNNER_OS" == "Linux" ]; then
if [ "$RUNNER_ARCH" == "ARM64" ]; then
filename=ninja-linux-aarch64.zip
else
filename=ninja-linux.zip
fi
checksum="sha512sum"
else
echo "$RUNNER_OS not supported"
exit 1
fi
if ! $wget -q "https://github.com/ninja-build/ninja/releases/download/v1.12.0/$filename" ; then
echo "Couldn't download $filename file"
exit 2
fi

echo 1. ls $GITHUB_ACTION_PATH
ls $GITHUB_ACTION_PATH

echo 2. pwd
pwd

echo 3. ls .
ls .

if ! $checksum --ignore-missing --check checksums.txt ; then
echo "Invalid SHA512 checksum"
exit 3
fi
mkdir -p "$HOME/.local/bin"
unzip -d "$HOME/.local/bin" "$filename"

0 comments on commit 0ceb5f1

Please sign in to comment.