CI: Run tests in source tree since the tests are not installed as par… #469
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-latest | |
- macos-latest | |
python-version: | |
- "3.14-dev" | |
- "3.13" | |
- "3.12" | |
- "3.11" | |
- "3.10" | |
- "3.9" | |
- "3.8" | |
- "pypy-3.8" | |
- "pypy-3.9" | |
- "pypy-3.10" | |
lua-version: | |
- "bundle" | |
- "lua5.3" | |
- "lua5.2" | |
- "luajit-5.1" | |
exclude: | |
- 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 | |
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 }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Python packages | |
run: | | |
python -m pip install -U 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 build_ext -i -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: | | |
bash -c "python -m pip install dist/lupa-*.whl" | |
python -m lupa.tests.__main__ | |
continue-on-error: ${{ contains(matrix.python-version, 'pypy') }} | |
- 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 |