Python package #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# | |
# k2hr3client - Python client for K2HR3 REST API | |
# | |
# Copyright 2020 Yahoo Japan Corporation | |
# Copyright 2024 LY Corporation | |
# | |
# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers | |
# common management information for the cloud. | |
# K2HR3 can dynamically manage information as "who", "what", "operate". | |
# These are stored as roles, resources, policies in K2hdkc, and the | |
# client system can dynamically read and modify these information. | |
# | |
# For the full copyright and license information, please view | |
# the license file that was distributed with this source code. | |
# | |
# AUTHOR: Hirotaka Wakabayashi | |
# CREATE: Mon Sep 14 2020 | |
# REVISION: | |
# | |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.12", "3.11", "3.10", "3.9"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: "x64" | |
- name: Install dependencies | |
run: | | |
make init | |
shell: sh | |
- name: Install dependencies in GHA | |
run: | | |
python -m pip install --upgrade pip | |
pipenv install --deploy --dev | |
- name: Lint with pylint | |
run: | | |
pipenv run flake8 src/k2hr3client | |
pipenv run mypy src/k2hr3client | |
pipenv run pylint src/k2hr3client | |
pipenv run python3 setup.py checkdocs | |
shell: sh | |
- name: Test with unittest | |
run: | | |
pipenv run python3 -m unittest discover src | |
shell: sh | |
- name: Install dependencies for upload pypi package | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
if: startsWith(github.ref, 'refs/tags') | |
run: python -m build | |
- name: Publish distribution to PyPI | |
if: ${{ matrix.python-version == '3.11' && startsWith(github.ref, 'refs/tags') }} | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
# | |
# Local variables: | |
# tab-width: 4 | |
# c-basic-offset: 4 | |
# End: | |
# vim600: expandtab sw=4 ts=4 fdm=marker | |
# vim<600: expandtab sw=4 ts=4 | |
# |