1
1
name : build
2
2
3
- # Build and test NautilusTrader
4
-
5
3
on :
6
4
push :
7
- branches : [master, develop]
5
+ branches : [master, nightly, develop]
8
6
pull_request :
9
7
branches : [develop]
10
8
14
12
fail-fast : false
15
13
matrix :
16
14
arch : [x64]
17
- os : [ubuntu-latest, macos-latest, windows-latest]
15
+ os : [ubuntu-latest, windows-latest]
18
16
python-version : ["3.10", "3.11", "3.12"]
19
17
defaults :
20
18
run :
@@ -38,21 +36,11 @@ jobs:
38
36
working-directory : ${{ github.workspace }}
39
37
40
38
- name : Set up Rust tool-chain (Linux, Windows) stable
41
- if : (runner.os == 'Linux') || (runner.os == 'Windows')
42
39
uses : actions-rust-lang/setup-rust-toolchain@v1.5
43
40
with :
44
41
toolchain : ${{ env.RUST_VERSION }}
45
42
components : rustfmt, clippy
46
43
47
- # Work around as actions-rust-lang does not seem to work on macOS yet
48
- - name : Set up Rust tool-chain (macOS) stable
49
- if : runner.os == 'macOS'
50
- uses : actions-rs/toolchain@v1
51
- with :
52
- toolchain : ${{ env.RUST_VERSION }}
53
- override : true
54
- components : rustfmt, clippy
55
-
56
44
- name : Set up Python environment
57
45
uses : actions/setup-python@v4
58
46
with :
@@ -99,24 +87,20 @@ jobs:
99
87
# pre-commit run --hook-stage manual gitlint-ci
100
88
pre-commit run --all-files
101
89
102
- - name : Install Redis (macOS)
103
- if : runner.os == 'macOS'
104
- run : |
105
- brew install redis
106
- redis-server --daemonize yes
107
-
108
90
- name : Install Redis (Linux)
109
91
if : runner.os == 'Linux'
110
92
run : |
111
93
sudo apt-get install redis-server
112
94
redis-server --daemonize yes
113
95
114
- - name : Run nautilus_core cargo tests (Linux, macOS)
115
- if : (runner.os == 'Linux') || (runner.os == 'macOS')
116
- run : make cargo-test
96
+ - name : Run nautilus_core cargo tests (Linux)
97
+ if : runner.os == 'Linux'
98
+ run : |
99
+ cargo install cargo-nextest
100
+ make cargo-test
117
101
118
- - name : Run tests (Linux, macOS )
119
- if : ( runner.os == 'Linux') || (runner.os == 'macOS')
102
+ - name : Run tests (Linux)
103
+ if : runner.os == 'Linux'
120
104
run : |
121
105
make pytest
122
106
make test-examples
@@ -129,3 +113,95 @@ jobs:
129
113
poetry run pytest --ignore=tests/performance_tests --new-first --failed-first
130
114
env :
131
115
PARALLEL_BUILD : false
116
+
117
+ build-macos :
118
+ if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/nightly'
119
+ strategy :
120
+ fail-fast : false
121
+ matrix :
122
+ arch : [x64]
123
+ os : [macos-latest]
124
+ python-version : ["3.10", "3.11", "3.12"]
125
+ defaults :
126
+ run :
127
+ shell : bash
128
+ name : build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
129
+ runs-on : ${{ matrix.os }}
130
+ env :
131
+ BUILD_MODE : debug
132
+ RUST_BACKTRACE : 1
133
+
134
+ steps :
135
+ - name : Checkout repository
136
+ uses : actions/checkout@v4
137
+
138
+ - name : Get Rust version from rust-toolchain.toml
139
+ id : rust-version
140
+ run : |
141
+ version=$(awk -F\" '/version/ {print $2}' nautilus_core/rust-toolchain.toml)
142
+ echo "Rust toolchain version $version"
143
+ echo "RUST_VERSION=$version" >> $GITHUB_ENV
144
+ working-directory : ${{ github.workspace }}
145
+
146
+ # Work around as actions-rust-lang does not seem to work on macOS yet
147
+ - name : Set up Rust tool-chain (macOS) stable
148
+ uses : actions-rs/toolchain@v1
149
+ with :
150
+ toolchain : ${{ env.RUST_VERSION }}
151
+ override : true
152
+ components : rustfmt, clippy
153
+
154
+ - name : Set up Python environment
155
+ uses : actions/setup-python@v4
156
+ with :
157
+ python-version : ${{ matrix.python-version }}
158
+
159
+ - name : Get Poetry version from poetry-version
160
+ run : |
161
+ version=$(cat poetry-version)
162
+ echo "POETRY_VERSION=$version" >> $GITHUB_ENV
163
+
164
+ - name : Install Poetry
165
+ uses : snok/install-poetry@v1
166
+ with :
167
+ version : ${{ env.POETRY_VERSION }}
168
+
169
+ - name : Install build dependencies
170
+ run : python -m pip install --upgrade pip setuptools wheel pre-commit msgspec
171
+
172
+ - name : Setup cached pre-commit
173
+ id : cached-pre-commit
174
+ uses : actions/cache@v3
175
+ with :
176
+ path : ~/.cache/pre-commit
177
+ key : ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
178
+
179
+ - name : Set poetry cache-dir
180
+ run : echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV
181
+
182
+ - name : Poetry cache
183
+ id : cached-poetry
184
+ uses : actions/cache@v3
185
+ with :
186
+ path : ${{ env.POETRY_CACHE_DIR }}
187
+ key : ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}
188
+
189
+ - name : Run pre-commit
190
+ run : |
191
+ # pre-commit run --hook-stage manual gitlint-ci
192
+ pre-commit run --all-files
193
+
194
+ - name : Install Redis (macOS)
195
+ run : |
196
+ brew install redis
197
+ redis-server --daemonize yes
198
+
199
+ - name : Run nautilus_core cargo tests (macOS)
200
+ run : |
201
+ cargo install cargo-nextest
202
+ make cargo-test
203
+
204
+ - name : Run tests (macOS)
205
+ run : |
206
+ make pytest
207
+ make test-examples
0 commit comments