continuous-integration #932
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
# 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 | |
- deploy/pkg/pyproject/.pyproject.toml | |
- MANIFEST.in | |
- Makefile | |
- .gitignore | |
- .github/workflows/ci.yml | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- src/** | |
- tests/** | |
- setup.py | |
- setup.cfg | |
- deploy/pkg/pyproject/.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: | |
# HACK: GitHub macOS runner defaults to a broken release of Xcode. | |
# See https://github.com/actions/runner-images/issues/9273. | |
- name: Pin Xcode version (macOS) | |
if: runner.os == 'macOS' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- 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 libomp | |
- 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++*') | |
# # Optional: Override ``-arch`` flags to exclude non-native | |
# # architectures, relevant for x86_64 architecture only. | |
# export ARCHFLAGS="-arch x86_64" | |
# # Optional: Eliminate linker version warning. | |
# export MACOSX_DEPLOYMENT_TARGET=10.13 | |
# 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" | |
# # Optional: Override ``-arch`` flags to exclude non-native | |
# # architectures, relevant for x86_64 architecture only. | |
# export ARCHFLAGS="-arch x86_64" | |
# # Optional: Eliminate linker version warning. | |
# export MACOSX_DEPLOYMENT_TARGET=10.13 | |
# 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 |