16
16
arch : [x64]
17
17
os : [ubuntu-latest, macos-latest, windows-latest]
18
18
python-version : ["3.9", "3.10", "3.11"]
19
+ defaults :
20
+ run :
21
+ shell : bash
19
22
name : build - Python ${{ matrix.python-version }} (${{ matrix.arch }} ${{ matrix.os }})
20
23
runs-on : ${{ matrix.os }}
21
24
env :
@@ -24,21 +27,29 @@ jobs:
24
27
25
28
steps :
26
29
- name : Checkout repository
27
- uses : actions/checkout@v3
30
+ uses : actions/checkout@v4
31
+
32
+ - name : Get Rust version from rust-toolchain.toml
33
+ id : rust-version
34
+ run : |
35
+ version=$(awk -F\" '/version/ {print $2}' nautilus_core/rust-toolchain.toml)
36
+ echo "Rust toolchain version $version"
37
+ echo "RUST_VERSION=$version" >> $GITHUB_ENV
38
+ working-directory : ${{ github.workspace }}
28
39
29
40
- name : Set up Rust tool-chain (Linux, Windows) stable
30
41
if : (runner.os == 'Linux') || (runner.os == 'Windows')
31
42
uses :
actions-rust-lang/[email protected]
32
43
with :
33
- toolchain : stable
44
+ toolchain : ${{ env.RUST_VERSION }}
34
45
components : rustfmt, clippy
35
46
36
47
# Work around as actions-rust-lang does not seem to work on macOS yet
37
48
- name : Set up Rust tool-chain (macOS) stable
38
49
if : runner.os == 'macOS'
39
50
uses : actions-rs/toolchain@v1
40
51
with :
41
- toolchain : stable
52
+ toolchain : ${{ env.RUST_VERSION }}
42
53
override : true
43
54
components : rustfmt, clippy
44
55
47
58
with :
48
59
python-version : ${{ matrix.python-version }}
49
60
61
+ - name : Get Poetry version from poetry-version
62
+ run : |
63
+ version=$(cat poetry-version)
64
+ echo "POETRY_VERSION=$version" >> $GITHUB_ENV
65
+
66
+ - name : Install Poetry
67
+ uses : snok/install-poetry@v1
68
+ with :
69
+ version : ${{ env.POETRY_VERSION }}
70
+
50
71
- name : Install build dependencies
51
- run : python -m pip install --upgrade pip setuptools wheel pre-commit poetry==1.6.1 msgspec
72
+ run : python -m pip install --upgrade pip setuptools wheel pre-commit msgspec
52
73
53
74
- name : Setup cached pre-commit
54
75
id : cached-pre-commit
@@ -57,19 +78,14 @@ jobs:
57
78
path : ~/.cache/pre-commit
58
79
key : ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
59
80
60
- - name : Setup poetry output (Linux, macOS)
61
- if : (runner.os == 'Linux') || (runner.os == 'macOS')
62
- run : echo "dir=$(poetry config cache-dir)" >> $GITHUB_ENV
63
-
64
- - name : Setup poetry output (Windows)
65
- if : runner.os == 'Windows'
66
- run : echo "dir=$(poetry config cache-dir)" | Out-File -FilePath $env:GITHUB_ENV -Append >> $GITHUB_ENV
81
+ - name : Set poetry cache-dir
82
+ run : echo "POETRY_CACHE_DIR=$(poetry config cache-dir)" >> $GITHUB_ENV
67
83
68
84
- name : Poetry cache
69
85
id : cached-poetry
70
86
uses : actions/cache@v3
71
87
with :
72
- path : ${{ env.dir }}
88
+ path : ${{ env.POETRY_CACHE_DIR }}
73
89
key : ${{ runner.os }}-${{ matrix.python-version }}-poetry-${{ hashFiles('**/poetry.lock') }}
74
90
75
91
- name : Run pre-commit
0 commit comments