yair 0.1.0

A compiler framework written entirely in Rust
name: Rust

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true

      # make sure all code has been formatted with rustfmt
      - run: rustup component add rustfmt
      - name: check rustfmt
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: -- --check --color always

      # run clippy to verify we have no warnings
      - run: rustup component add clippy
      - name: cargo fetch
        uses: actions-rs/cargo@v1
        with:
          command: fetch
      - name: cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --lib --tests -- -D warnings

      # make sure cargo deny does not result in any errors
      - run: cargo install cargo-deny --locked
      - name: cargo deny
        uses: actions-rs/cargo@v1
        with:
          command: deny
          args: check

  windows:
    name: Build with LLVM on Windows
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - run: powershell.exe -NoP -NonI -Command "Invoke-WebRequest https://github.com/WAVM/WAVM-LLVM/releases/download/11.x/Win64_Release.zip -O Win64_Release.zip"
    - run: powershell.exe -NoP -NonI -Command "Expand-Archive '.\Win64_Release.zip' '.\llvm\'"
    - run: ls -R
    - run: cargo test
      env:
        YAIR_LLVM_INSTALL_DIR: llvm

  linux:
    name: Build with LLVM on Linux
    runs-on: ubuntu-16.04
    steps:
    - uses: actions/checkout@v2
    - run: wget https://github.com/WAVM/WAVM-LLVM/releases/download/11.x/Ubuntu1604_Release.zip
    - run: unzip -d llvm Ubuntu1604_Release.zip
    - run: cargo test
      env:
        YAIR_LLVM_INSTALL_DIR: llvm

  mac:
    name: Build with LLVM on macOS
    runs-on: macOS-latest
    steps:
    - uses: actions/checkout@v2
    - run: wget https://github.com/WAVM/WAVM-LLVM/releases/download/11.x/MacOS_Release.zip
    - run: unzip -d llvm MacOS_Release.zip
    - run: cargo test
      env:
        YAIR_LLVM_INSTALL_DIR: llvm
      
  test-no-default-features:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v2
    - name: Test
      run: cargo test --no-default-features

  publish-check:
    name: Publish Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
      - name: cargo fetch
        uses: actions-rs/cargo@v1
        with:
          command: fetch
      - name: cargo publish
        uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --dry-run --no-default-features