Merge pull request #267 from vpython/bounding_box #573
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: Test/build | |
on: | |
workflow_dispatch: # Allows manual triggering | |
push: # only build on pusheess to the main branch | |
branches: | |
- master | |
pull_request: | |
# Stop current actions if there is a new push to the same branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
matrix: | |
python-version: [3.11, 3.12] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
# The include below adds jobs on older versions of python, | |
# but just on one platform. Windows is probably the most widely | |
# used for vpython, so test on that. | |
include: | |
- python-version: "3.8" | |
platform: windows-latest | |
- python-version: "3.9" | |
platform: windows-latest | |
- python-version: "3.10" | |
platform: windows-latest | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache location | |
id: pip-cache | |
run: | | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest Cython wheel build | |
- name: Build sdist and wheel | |
run: | | |
python -m build | |
- name: Install vpython | |
run: | | |
pip install . | |
- name: Run tests | |
run: | | |
pytest vpython | |
- name: Import test | |
run: | | |
python -c "import vpython" | |
build_aarch64: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312] | |
runs-on: ubuntu-latest | |
env: | |
py: /opt/python/${{ matrix.python-version }}/bin/python | |
img: quay.io/pypa/manylinux2014_aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: Build and Test | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '${{ env.py }} -m venv .env && \ | |
source .env/bin/activate && \ | |
echo -e "\e[1;34m Install dependencies \e[0m" && \ | |
python -m pip install --upgrade pip && \ | |
pip install pytest Cython wheel build && \ | |
echo -e "\e[1;34m Build wheel \e[0m" && \ | |
python -m build && \ | |
echo -e "\e[1;34m Install vpython \e[0m" && \ | |
pip install . && \ | |
echo -e "\e[1;34m Run tests \e[0m" && \ | |
pytest vpython && \ | |
echo -e "\e[1;34m Import test \e[0m" && \ | |
python -c "import vpython" && \ | |
deactivate' |