name: macOS

on:
  push:
    branches:
    - master
  pull_request:
    branches:
    - master

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [macos-10.14]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v1
    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
        profile: minimal
        toolchain: nightly
        override: true
    - name: Export OpenSSL environment variables
      run: |
        echo "::set-env name=OPENSSL_INCLUDE_DIR::$(brew --prefix openssl)/include"
        echo "::set-env name=OPENSSL_LIB_DIR::$(brew --prefix openssl)/lib"
    - name: Build and test
      run: |
        rustc -V
        cargo -V
        cargo build
        tests/run_integration_tests.sh
        rustdoc --test README.md -L target
        cargo run --manifest-path systest/Cargo.toml