-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (81 loc) · 2.9 KB
/
build.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: build
# When the 'permissions' key is specified, unspecified permission scopes (e.g.,
# actions, checks, etc.) are set to no access (none).
permissions:
contents: read
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# Run weekly (* is a special character in YAML, so quote the string)
- cron: '0 0 * * 0'
workflow_dispatch:
inputs:
# When git-ref is empty, HEAD will be checked out.
git-ref:
description: Optional git ref (branch, tag, or full SHA)
required: false
jobs:
build:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
config:
- os: ubuntu-latest
cc: clang
cxx: clang++
- os: ubuntu-latest
cc: gcc
cxx: g++
- os: windows-latest
- os: macos-latest
exclude:
# Python 3.6 is not supported on GitHub-hosted Ubuntu runners as of Ubuntu 22.04.
# https://github.com/actions/setup-python/issues/544#issuecomment-1332535877
- {config: {os: ubuntu-latest}, python-version: '3.6'}
# Python versions prior to 3.8 are not supported on GitHub-hosted macOS runners
# as of macOS 14.
# https://github.com/actions/runner-images/issues/9770
- {config: {os: macos-latest}, python-version: '3.5'}
- {config: {os: macos-latest}, python-version: '3.6'}
- {config: {os: macos-latest}, python-version: '3.7'}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# When the ref is empty, HEAD will be checked out.
ref: ${{ github.event.inputs.git-ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Lint
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Typing
run: |
python -m pip install mypy
python -m mypy kmeans1d
- name: Install (ubuntu)
if: matrix.config.os == 'ubuntu-latest'
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: pip install --verbose .
- name: Install (other)
if: matrix.config.os != 'ubuntu-latest'
run: pip install --verbose .
- name: Test
run: |
cd tests # so package is imported from site-packages instead of working directory
python -m unittest discover . -v