diff --git a/action.yml b/action.yml index fc7f4f8..6c490d2 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/checksums.txt b/checksums.txt new file mode 100644 index 0000000..9baa188 --- /dev/null +++ b/checksums.txt @@ -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 diff --git a/install-ninja.sh b/install-ninja.sh new file mode 100755 index 0000000..c3ac0c2 --- /dev/null +++ b/install-ninja.sh @@ -0,0 +1,39 @@ +#! /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 + +cp $GITHUB_ACTION_PATH/checksums.txt . +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"