<gh_stars>10-100
name: Build
on: [push, pull_request]

jobs:
  build:
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    strategy:
      fail-fast: false
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy3"]
        architecture: ["x64", "x86"]
    name: ${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.python-version }}
    runs-on: ${{ matrix.platform }}
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}

    - name: Set Environment Variables
      uses: allenevans/set-env@v2.0.0
      with:
        ACTIONS_ALLOW_UNSECURE_COMMANDS: true
        GITHUB_PATH: "$HOME/.nimble/bin"

    - name: Test (Linux)
      if: runner.os == 'Linux'
      shell: bash
      run: |
        sudo pip --no-color --no-python-version-warning --disable-pip-version-check --no-cache-dir --no-input --verbose install dist/

    - name: Test (Mac)
      if: runner.os == 'macOS'
      continue-on-error: true
      shell: bash
      run: |
        sudo pip --no-color --no-python-version-warning --disable-pip-version-check --no-cache-dir --no-input --verbose install dist/

    - name: Test (Windows)
      if: runner.os == 'Windows'
      shell: bash
      run: |
        pip --no-color --no-python-version-warning --disable-pip-version-check --no-cache-dir --no-input --verbose install dist/
        echo "$HOME/.nimble/bin" >> $GITHUB_PATH

    - name: After-Install Nim/Nimble Test
      shell: bash
      run: |
        nim -v
        nimble -v

    - name: After-Install StdLib PATH Test
      shell: bash
      run: |
        echo "import std/strutils" > temp.nim
        nim c temp.nim

    - name: After-Install Nimble libs PATH Test
      shell: bash
      run: |
        echo "import cpython/math" > temp.nim
        nim c temp.nim
