-
Notifications
You must be signed in to change notification settings - Fork 4
143 lines (121 loc) · 3.78 KB
/
ci.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Perform continuous integration (CI) checks.
#
# CI tasks include but are not limited to:
# - development builds (on all supported OS);
# - unit/integration tests;
# - code linting.
#
name: continuous-integration
on:
push:
branches:
- main
- 'v[0-9]+'
paths:
- src/**
- tests/**
- setup.py
- setup.cfg
- pyproject.toml
- MANIFEST.in
- Makefile
- .gitignore
- .github/workflows/ci.yml
pull_request:
types: [opened, synchronize, reopened]
paths:
- src/**
- tests/**
- setup.py
- setup.cfg
- pyproject.toml
- MANIFEST.in
- Makefile
- .gitignore
- .github/workflows/ci.yml
pull_request_review:
types: [submitted, edited]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test-dev:
name: Build & test (in dev mode)
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, llvm]
exclude:
- os: ubuntu-latest
compiler: llvm
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python build system requirements
run: python -m pip install --upgrade pip
- name: Install C++ build dependency requirements
uses: knicknic/os-specific-run@v1.0.4
with:
linux: |
sudo apt-get update
sudo apt-get install -y libgsl-dev libfftw3-dev
macos: |
# # Optional: Homebrew update is slow.
# brew update
brew install gsl fftw
- name: Build and install (Linux)
if: runner.os == 'Linux'
run: make clean; make -j -O install useomp=true
- name: Build and install (macOS with GCC)
if: runner.os == 'macOS' && matrix.compiler == 'gcc'
run: |
# Override default compiler and OpenMP to GCC on macOS.
export CXX=$(find $(brew --prefix gcc)/bin -type f -name 'g++*')
# Override ``-arch`` flags to exclude non-native architectures.
export ARCHFLAGS="-arch x86_64"
# # Optional: Eliminate linker version warning.
# export MACOSX_DEPLOYMENT_TARGET=10.9
# Build.
make clean; make -j install useomp=true
- name: Build and install (macOS with LLVM)
if: runner.os == 'macOS' && matrix.compiler == 'llvm'
run: |
# Override default compiler and OpenMP to LLVM on macOS.
export CXX=$(brew --prefix llvm@15)/bin/clang++
export CXXFLAGS_OMP="-I$(brew --prefix libomp)/include -fopenmp"
export LDFLAGS_OMP="-L$(brew --prefix libomp)/lib -lomp"
# Override ``-arch`` flags to exclude non-native architectures.
export ARCHFLAGS="-arch x86_64"
# # Optional: Eliminate linker version warning.
# export MACOSX_DEPLOYMENT_TARGET=10.9
# Build.
make clean; make -j install useomp=true
- name: Install Python test requirements
run: python -m pip install --upgrade pytest
- name: Test
run: pytest
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python linting requirements
run: python -m pip install flake8
- name: Lint
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --statistics