klitsche/clang-ffi

View on GitHub
.github/workflows/test-macos.yml

Summary

Maintainability
Test Coverage
name: Build macOS

on:
  push:
  pull_request:

jobs:
  tests-macos:
    name: Tests
    runs-on: macos-latest
    strategy:
      fail-fast: false
      matrix:
        php:
          - '7.4'
          - '8.0'
          - '8.1'
        llvm:
          - '9'
# not available          - '10'
          - '11'
          - '12'
# not available         - '13'
    continue-on-error: ${{ matrix.php == '8.1' }}
    defaults:
      run:
        shell: bash
    env:
      PHP_VERSION: ${{ matrix.php }}
      LLVM_VERSION: ${{ matrix.llvm }}
      COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
      GH_TOKEN: ${{ secrets.GH_TOKEN }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install llvm ${{ matrix.llvm }}
        shell: bash
        run: |
          brew update
          brew install llvm@$LLVM_VERSION
          /usr/local/opt/llvm@$LLVM_VERSION/bin/clang --version

      - name: Install PHP ${{ matrix.php }}
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: none
          extensions: ffi

      - name: Get composer cache directory
        id: composer-cache
        run: |
          echo "::set-output name=dir::$(composer config cache-files-dir)"
      - name: Cache composer cache directory
        uses: actions/cache@v2
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
          restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
      - name: Install dependencies
        run: |
          composer config extra.clang-ffi --json "{\"Darwin\":{\"clangBin\":\"/usr/local/opt/llvm@$LLVM_VERSION/bin/clang\"}}"
          composer update --prefer-dist --prefer-stable --no-interaction -vvv

      - name: Run tests
        run: |
          composer test