-
Notifications
You must be signed in to change notification settings - Fork 2
173 lines (169 loc) · 6.21 KB
/
pull-request.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: "Pull Request Test"
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- id: file_changes
uses: tj-actions/changed-files@v44
- uses: pre-commit/[email protected]
with:
extra_args: --files ${{ steps.file_changes.outputs.all_changed_files}}
build-linux:
name: Build Linux
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.10"]
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache conan packages
id: cache-conan
uses: actions/cache@v4
with:
# conan cache files are stored in `~/.conan` on Linux/macOS
path: ~/.conan
key:
conan-packages-${{ runner.os }}-hash-${{ hashFiles('conanfile.py') }}
restore-keys: |
conan-packages-${{ runner.os }}-hash-
- name: Cache pip modules
id: cache-pip
uses: actions/cache@v4
env:
cache-name: cache-pip-modules
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: "Install swig and cmake"
run: sudo apt-get update && sudo apt-get install build-essential cmake gtk2.0 libgtk2.0-dev ninja-build swig -y
- name: "Install python packages"
run: sudo apt-get install python3-setuptools python3-tk
- name: "Create virtual Environment"
run: |
python${{ matrix.python-version }} -m venv .venv
source .venv/bin/activate
echo "VIRTUAL ENV:" $VIRTUAL_ENV
- name: "Install wheel and conan package"
run: source .venv/bin/activate && pip3 install -r requirements.txt
- name: "Build basilisk"
run: source .venv/bin/activate && python3 conanfile.py --opNav True
- name: "Run Python Tests"
run: |
source .venv/bin/activate
cd src && pytest -n auto -m "not scenarioTest" --junitxml=../junit/test-results-${{ matrix.python-version }}.xml
- name: "Upload pytest test results"
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: "Run C/C++ Tests"
working-directory: ./dist3
run: ctest
if: ${{ always() }}
build-windows:
name: Build Windows
runs-on: windows-2022
strategy:
matrix:
python-version: ["3.10"]
permissions:
actions: read
contents: read
security-events: write
env:
MPLBACKEND: agg
CONAN_USER_HOME: C:\Users\runneradmin\
CONAN_USER_HOME_SHORT: None
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/requirements.txt'
- name: Cache conan packages
id: cache-conan
uses: actions/cache@v4
env:
cache-name: cache-conan-packages
with:
path: C:\Users\runneradmin\.conan
key:
conan-packages-${{ runner.os }}-hash-${{ hashFiles('conanfile.py') }}
restore-keys: |
conan-packages-${{ runner.os }}-hash-
- name: Choco help
uses: crazy-max/ghaction-chocolatey@v3
with:
args: -h
- name: "Install swig and cmake"
shell: pwsh
run: choco install swig cmake -y
- name: "Create python virtual env"
shell: pwsh
run: python -m venv venv
- name: "Install wheel and conan package"
shell: pwsh
run: |
venv\Scripts\activate
pip install -r requirements.txt
- name: "Add basilisk and cmake path to env path"
shell: pwsh
run: |
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newpath = “$oldpath;${{ env.GITHUB_WORKSPACE }}\dist3\Basilisk;C:\Program Files\CMake\bin”
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
- name: "Build basilisk"
shell: pwsh
run: |
venv\Scripts\activate
python conanfile.py --opNav True
- name: "Test Simulation Python"
shell: pwsh
run: |
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name MPLBACKEND -Value ${MPLBACKEND}
venv\Scripts\activate
cd src\simulation
(Get-ChildItem -Directory).FullName | ForEach-Object { cd $_; pytest -n auto -m "not scenarioTest"; if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}}
- name: "Python Architecture Tests"
shell: pwsh
run: |
venv\Scripts\activate
cd src\architecture
(Get-ChildItem -Directory).FullName | ForEach-Object { cd $_; pytest -n auto; if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}}
- name: "Python FswAlgorithms Tests"
shell: pwsh
run: |
venv\Scripts\activate
cd src\fswAlgorithms
(Get-ChildItem -Directory).FullName | ForEach-Object { cd $_; pytest -n auto; if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}}
- name: "C/C++ Tests"
shell: pwsh
run: |
cd dist3
ctest
if(($LastExitCode -ne 0) -and ($LastExitCode -ne 5)) {exit 1}