-
Notifications
You must be signed in to change notification settings - Fork 10
119 lines (97 loc) · 3.47 KB
/
test.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
117
118
119
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 The Foundry Visionmongers Ltd
# Runs pytest on the matrix of supported platforms any Python versions.
name: Test
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-python:
name: "${{ matrix.os }} python-${{ matrix.python }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-2022", "ubuntu-22.04", "macos-13"]
python: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- run: |
python -m pip install -r tests/python/requirements.txt
python -m pip install .
- name: Test
run: python -m pytest -v
test-cpp:
name: Test Cpp
runs-on: ubuntu-latest
container:
image: ghcr.io/openassetio/openassetio-build
steps:
- uses: actions/checkout@v3
- name: Build OpenAssetIO
uses: ./.github/build_openassetio
with:
install-prefix: openassetio
- name: Install Traitgen
run: python -m pip install openassetio-traitgen==1.0.0a10
- name: Configure CMake build
run: |
cmake -S . -DCMAKE_PREFIX_PATH=$(pwd)/openassetio -B build -G Ninja --preset test
- name: Build tests
run: cmake --build build
- name: Test
run: ctest -VV --test-dir build/tests/cpp --parallel 4
test-python-from-cmake:
# To support hybrid C++ applications, the python package may also be
# generated using the CMake packaging, in addition and simultaneously
# to the C++ package. This tests that.
name: "Test Python From CMake"
runs-on: ubuntu-latest
container:
image: aswf/ci-base:2024
steps:
- uses: actions/checkout@v3
- name: Install Traitgen
run: python -m pip install openassetio-traitgen==1.0.0a10
- name: Configure CMake build
run: >
cmake -S . -B build -G Ninja
-DOPENASSETIO_MEDIACREATION_GENERATE_PYTHON=ON
-DOPENASSETIO_MEDIACREATION_PYTHON_SITEDIR="hybridpython"
- name: Install package
run: cmake --install build
- name: Install OpenAssetIO
run: python -m pip install openassetio>=1.0.0a6
- name: Test
run: |
python -m pip install -r tests/python/requirements.txt
PYTHONPATH=$(pwd)/build/dist/hybridpython python -m pytest -v
disallowed_pip_install:
name: Disallowed pip install
runs-on: ubuntu-latest
container:
image: aswf/ci-base:2024
steps:
- uses: actions/checkout@v3
- name: Install Traitgen
run: python -m pip install openassetio-traitgen==1.0.0a10
- name: Set Python Root Dir
run: echo "Python_ROOT_DIR=$(python -c 'import sys; print(sys.prefix)')" >> $GITHUB_ENV
- name: Configure CMake build
run: >
cmake -S . -B build --install-prefix $Python_ROOT_DIR -DOPENASSETIO_MEDIACREATION_GENERATE_PYTHON=ON
- name: Install package
run: cmake --install build
- name: Attempt to install using pip
# The runner has pipefail set, so if either the pip install
# succeeds (inverted via `!`) or the grep fails, then the step
# will fail.
run: >
! python -m pip install --upgrade --force-reinstall openassetio-mediacreation 2>&1
| grep "The package was installed by cmake"
shell: bash