-
Notifications
You must be signed in to change notification settings - Fork 64
116 lines (96 loc) · 3.14 KB
/
build.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
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'