CI: Make test command work with recent setuptools. #457
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
name: Continuous Integration | |
on: [push, pull_request] | |
jobs: | |
build: | |
strategy: | |
# Allows for matrix sub-jobs to fail without canceling the rest | |
fail-fast: false | |
matrix: | |
os: | |
- windows-2019 | |
- ubuntu-20.04 | |
- macos-latest | |
python-version: | |
- "2.7" | |
- "3.12" | |
- "3.11" | |
- "3.10" | |
- "3.9" | |
- "3.8" | |
- "3.7" | |
- "3.6" | |
- "pypy-2.7" | |
- "pypy-3.7" | |
- "pypy-3.8" | |
- "pypy-3.9" | |
- "pypy-3.10" | |
lua-version: | |
- "bundle" | |
- "lua5.3" | |
- "lua5.2" | |
- "luajit-5.1" | |
exclude: | |
- os: windows-2019 | |
python-version: "2.7" | |
- os: windows-2019 | |
python-version: pypy-2.7 | |
- os: windows-2019 | |
lua-version: lua5.2 | |
- os: windows-2019 | |
lua-version: lua5.3 | |
- os: windows-2019 | |
lua-version: lua5.4 | |
- os: windows-2019 | |
lua-version: luajit-5.1 | |
- os: macos-latest | |
python-version: "2.7" | |
- os: macos-latest | |
python-version: "3.6" | |
- os: macos-latest | |
python-version: "3.7" | |
- os: macos-latest | |
python-version: pypy-3.7 | |
- os: macos-latest | |
lua-version: lua5.2 | |
- os: macos-latest | |
lua-version: lua5.3 | |
- os: macos-latest | |
lua-version: lua5.4 | |
- os: macos-latest | |
lua-version: luajit-5.1 | |
runs-on: ${{ matrix.os }} | |
env: | |
CFLAGS_LTO: ${{ contains(matrix.lua-version, 'bundle') && (contains(matrix.os, 'windows') && '/LTCG' || '-flto') || '' }} | |
CFLAGS: ${{ contains(matrix.os, 'windows') && '/O2' || '-O2 -fPIC' }} -g | |
MACOSX_DEPLOYMENT_TARGET: "11.0" | |
LUPA_WITH_LUA_DLOPEN: ${{ startsWith(matrix.os, 'windows') && 'false' || 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check out recursively | |
run: git submodule update --init --recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
if: startsWith(matrix.python-version, '3.') || startsWith(matrix.python-version, 'pypy') || !startsWith(matrix.os, 'ubuntu') | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Python2 (Linux) | |
if: matrix.python-version == '2.7' && startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo ln -fs python2 /usr/bin/python | |
sudo apt-get update | |
sudo apt-get install python-setuptools python2.7 python2.7-dev | |
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py | |
sudo python2 get-pip.py | |
ls -l /usr/bin/pip* /usr/local/bin/pip* | |
which pip | |
- name: Set up Python packages | |
run: | | |
python -m pip install -U ${{ startsWith(matrix.python-version, '2.7') && '"pip<21" "setuptools<45"' || 'pip setuptools' }} | |
python -m pip install -U wheel tox virtualenv -r requirements.txt | |
- name: Set up Lua ${{ matrix.lua-version }} | |
if: contains(matrix.os, 'ubuntu') && matrix.lua-version != 'bundle' | |
run: sudo apt-get install lib${{ matrix.lua-version }}-dev | |
- name: Build wheel | |
run: python setup.py sdist ${{ contains(matrix.python-version, '3.') && 'build_ext -j6' || '' }} bdist_wheel | |
env: | |
SETUP_OPTIONS: ${{ !contains(matrix.lua-version, 'luajit') && (contains(matrix.lua-version, 'bundle') && '--use-bundle' || '--no-luajit') || '' }} | |
CFLAGS: ${{ env.CFLAGS }} ${{ env.CFLAGS_LTO }} | |
LDFLAGS: ${{ env.CFLAGS_LTO }} | |
- name: Run tests | |
run: python -m lupa.tests.__main__ | |
continue-on-error: ${{ contains(matrix.python-version, 'pypy') }} | |
env: | |
SETUP_OPTIONS: ${{ !contains(matrix.lua-version, 'luajit') && (contains(matrix.lua-version, 'bundle') && '--use-bundle' || '--no-luajit') || '' }} | |
CFLAGS: ${{ env.CFLAGS }} ${{ env.CFLAGS_LTO }} | |
LDFLAGS: ${{ env.CFLAGS_LTO }} | |
- name: Upload wheels | |
if: matrix.lua-version == 'bundle' && matrix.os == 'macos-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.os }}-${{ matrix.python-version }} | |
path: dist/*.whl | |
if-no-files-found: ignore |