👻

GITHUB ACTIONSでpoetryを使ったpytestをする

2021/12/08に公開

ハマったところ

python 3.10では動かないので3.9にする

3.10では下記のエラー

ModuleNotFoundError: No module named 'cleo'

今回は3.9にして問題なかったのでバージョンを下げて対応しました

.github/workflows/python-package.yml
name: Python package

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

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.9"]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install poetry
      run: |
        curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
        echo "$HOME/.poetry/bin" >> $GITHUB_PATH
    - name: Poetry Version
      run: |
        poetry --version
    - name: Poetry Install Dependencies
      run: |
        poetry install --no-interaction
    - name: Test with pytest
      run: |
        poetry run pytest
    - name: Lint with flake8
      run: |
        poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

Discussion