diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f1d965..59df005 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,15 +25,17 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - TWINE_REPOSITORY_URL: ${{ secrets.TWINE_REPOSITORY_URL }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Build and publish package + run: make publish diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index 4999c47..31b54f4 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -8,41 +8,32 @@ on: jobs: deploy: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v3 - - name: Setup Python uses: actions/setup-python@v4 with: python-version: '3.10' - - - name: Upgrade pip - run: | - # install pip=>20.1 to use "pip cache dir" - python3 -m pip install --upgrade pip - - - name: Get pip cache dir - id: pip-cache - run: echo "::set-output name=dir::$(pip cache dir)" - - - name: Cache dependencies + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies uses: actions/cache@v3 with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - run: | - python3 -m pip install -r ./requirements/doc.txt - python3 -m pip install . - + run: poetry install --no-interaction --with docs - name: Build sphinx docs run: | cd docs - make html - + poetry run make html - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80db119..78943a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,20 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.10' + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies + run: make install - name: Run flake8 check run: make flake8 - name: Run mypy check @@ -51,15 +65,24 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/dev.txt - pip install -e . + run: make install - name: Test with pytest - run: | - pytest - coverage xml + run: make test + - name: Make coverage report + run: coverage xml - name: Codecov Action uses: Atrox/codecov-action@v0.1.3 # This workflow contains a single job called "build" @@ -74,11 +97,21 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.10' + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies + run: pip install twine + - name: Build and test publishing package run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and check package with twine - run: | - python setup.py sdist bdist_wheel - twine check dist/*.whl \ No newline at end of file + make build + poetry run twine check dist/*.whl \ No newline at end of file