Skip to content

Poetry Setup

Poetry Setup #26

Workflow file for this run

# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This workflow will install Python dependencies,
# run tests with a variety of Python versions,
# and upload a new build to TestPyPI.
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Code Check
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
pre-commit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry install --with test
- name: Run pre-commit Check
uses: pre-commit/[email protected]
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python:
[
{ version: "3.9", coveralls: false },
{ version: "3.10", coveralls: false },
{ version: "3.11", coveralls: false },
{ version: "3.12", coveralls: true }, # publish coverage with latest version of Python
]
env:
PYTHON_VERSION: ${{ matrix.python.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry install --with test
- name: Run Pytest + Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.os }}
run: |
poetry run pytest
- name: Upload Coverage Report
uses: actions/[email protected]
with:
name: coverage
path: tests/reports/coverage.json
- name: Update Coveralls Report
uses: coverallsapp/[email protected]
if: ${{ matrix.python.coveralls }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: tests/reports/coverage.json
# testpypi-deploy:
# name: Build and publish Python 🐍 distributions 📦 to TestPyPI
# runs-on: ubuntu-latest
# needs: test
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Publish distribution 📦 to Test PyPI
# uses: JRubics/[email protected]
# continue-on-error: true
# with:
# pypi_token: ${{ secrets.TEST_PYPI_PASSWORD }}
# repository_name: 'testpypi'
# repository_url: 'https://test.pypi.org/legacy/'