From fd57ca9c233f9cb9844b2953bb19780d0ff0690e Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Tue, 10 Jan 2023 18:22:43 +0700 Subject: [PATCH 1/2] auto install `ninja-build` if generator is using Ninja --- .github/workflows/test.yml | 3 --- action.yml | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f789a00..11ed2af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,9 +79,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v3.3.0 - - name: Install Ninja - run: sudo apt install -y ninja-build - - name: Use this action with specified generator uses: ./ with: diff --git a/action.yml b/action.yml index ccb28c8..d7198fa 100644 --- a/action.yml +++ b/action.yml @@ -48,6 +48,11 @@ runs: echo "CMAKE_CONFIGURE_ARGS=${CONFIGURE_ARGS//[$'\t\r\n']}" >> $GITHUB_ENV echo "CMAKE_BUILD_ARGS=${BUILD_ARGS//[$'\t\r\n']}" >> $GITHUB_ENV + - name: Install Ninja + if: ${{ inputs.generator == 'Ninja' }} + shell: bash + run: sudo apt install -y ninja-build + - name: Configure CMake shell: bash run: cmake ${{ env.CMAKE_CONFIGURE_ARGS }} From f290ba80de4b851886a4540c50ac18f03fefc5ec Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Tue, 10 Jan 2023 18:35:21 +0700 Subject: [PATCH 2/2] run action with specified generator job on multiple platforms --- .github/workflows/test.yml | 5 ++++- action.yml | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11ed2af..d4a4e33 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,7 +74,10 @@ jobs: run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }} use-action-with-specified-generator: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] steps: - name: Checkout repository uses: actions/checkout@v3.3.0 diff --git a/action.yml b/action.yml index d7198fa..8c80fd3 100644 --- a/action.yml +++ b/action.yml @@ -51,7 +51,12 @@ runs: - name: Install Ninja if: ${{ inputs.generator == 'Ninja' }} shell: bash - run: sudo apt install -y ninja-build + run: | + case "$OSTYPE" in + darwin*) brew install ninja ;; + linux*) sudo apt install -y ninja-build ;; + *) choco install ninja ;; + esac - name: Configure CMake shell: bash