SforAiDl/genrl

View on GitHub
.github/workflows/test_linux.yml

Summary

Maintainability
Test Coverage
name: Tests Linux

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

jobs:
  build:
    
    strategy:
      matrix:
        python-version: [ '3.6','3.7','3.8' ]
        platform: [ubuntu-20.04]
    runs-on: ${{ matrix.platform }}
    
    name: Python ${{ matrix.python-version }} - ${{ matrix.platform }}
       
    steps:
      # Caching Linux
      - uses: actions/cache@v2
        if: startsWith(runner.os, 'Linux')
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      # Caching MacOS
      - uses: actions/cache@v2
        if: startsWith(runner.os, 'macOS')
        with:
          path: ~/Library/Caches/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      # Caching Windows
      - uses: actions/cache@v2
        if: startsWith(runner.os, 'Windows')
        with:
          path: ~\AppData\Local\pip\Cache
          key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-

      # Setup
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}

      - uses: goanpeca/setup-miniconda@v1
        with:
          auto-update-conda: true
          python-version: ${{ matrix.python-version }}
          activate-environment: test
      
      - name: Update conda env dependencies
        shell: bash -l {0}
        run: |
          conda config --set ssl_verify no
          conda install pytorch==1.4.0 torchvision==0.5.0 cpuonly -c pytorch
          pip install -f https://github.com/Kojoley/atari-py/releases atari_py
          conda env update environment.yml

      # Install Dependencies
      - name: Install Windows dependencies
        shell: pwsh
        if: startsWith(runner.os, 'Windows')
        run: |
          ./.scripts/windows_cpu_build.ps1

      - name: Install Linux Dependencies
        shell: bash -l {0}
        if: startsWith(runner.os, 'macOS') || startsWith(runner.os, 'Linux')
        run: |
          ./.scripts/unix_cpu_build.sh

      - name: Tests
        shell: bash -l {0}
        run: |
          conda activate test
          pytest --durations=0