-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (70 loc) · 2.09 KB
/
python-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# -*- coding: utf-8 -*-
#
# K2hash Python Driver under MIT License
#
# Copyright (c) 2022 Yahoo Japan Corporation
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Hirotaka Wakabayashi
# CREATE: Tue Feb 08 2022
# 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.11", "3.10", "3.9", "3.8"]
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: |
./.github/scripts/install_dependencies.sh
shell: sh
- name: Install dependencies in GHA
run: |
python -m pip install --upgrade pip
pip install pylint pytest
- name: Lint with pylint
run: |
./.github/scripts/lint_with_pylint.sh
shell: sh
- name: Test with unittest
run: |
python -I -m pip install 'setuptools>=42' wheel
pip install -q build
python -m build
pip3 install dist/k2hash-*.whl
pytest
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 }}