takuseno/d3rlpy

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
name: test

on: [push, pull_request]

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        # temporary drop windows test
        # os: [ubuntu-22.04, macos-latest, windows-latest]
        os: [ubuntu-22.04, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Setup Python.3.10.x
        uses: actions/setup-python@v5
        with:
          python-version: '3.10'
      - name: Cache pip
        uses: actions/cache@v1
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
            ${{ runner.os }}-
      - name: Install dependencies for Windows
        if: ${{ matrix.os == 'windows-latest' }}
        run: |
          pip install torch==1.13.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
      - name: Install dependencies for macOS
        if: ${{ matrix.os == 'macos-latest' }}
        run: |
          brew install libomp
      - name: Install packages
        run: |
          python -m pip install --upgrade pip
          pip install Cython numpy
          pip install -e .
          pip install -r dev.requirements.txt
      - name: Unit tests
        run: |
          mkdir -p test_data
          pytest --cov-report=xml --cov=d3rlpy --cov-config=.coveragerc tests -p no:warnings -v
      - name: Upload coverage
        if: ${{ matrix.os == 'ubuntu-22.04' }}
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        run: |
          bash <(curl -s https://codecov.io/bash)

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true