forked from ALU-Schumacher/AUDITOR
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (102 loc) · 3.71 KB
/
build_pyauditor.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
name: build-pyauditor
on:
pull_request:
push:
branches:
- main
tags:
- v*
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: cache-dependencies-linux
# We need to somehow get the SQLX_OFFLINE env variable into the container.
# Since `maturin-action` doesn't enable us to do that, we have to tell cargo
# via its configuration.
- name: Create fake .cargo/config.toml
run: |
mkdir -p .cargo
echo -e "[env]\nSQLX_OFFLINE = \"true\"" >> .cargo/config.toml
- name: Maturin
uses: messense/maturin-action@v1
with:
target: x86_64
manylinux: auto
command: build
args: --release --sdist -o dist --interpreter python${{ matrix.python-version }} --manifest-path pyauditor/Cargo.toml
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: linux-wheel-${{ matrix.python-version }}
path: dist
windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: cache-dependencies-windows
# We need to somehow get the SQLX_OFFLINE env variable into the container.
# Since `maturin-action` doesn't enable us to do that, we have to tell cargo
# via its configuration.
# I don't know how to script this on windows (and I don't care). Therefore
# I'll just copy the config.toml from the pyauditor directory. This may lead to
# problems when there is a .cargo/config.toml, which will then be overwritten.
- name: Create fake .cargo\config.toml
run: |
copy pyauditor\.cargo\config.toml .cargo\config.toml
# echo "[env]" >> .cargo\config.toml
# Fails here, saying "echo." doesn't exist.
# echo. >> .cargo\config.toml
# echo "SQLX_OFFLINE = \"true\"" >> .cargo\config.toml
# type .cargo\config.toml
- uses: messense/maturin-action@v1
with:
command: build
args: --release -o dist --interpreter python${{ matrix.python-version }} --manifest-path pyauditor/Cargo.toml
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: windows-wheel-${{ matrix.python-version }}
path: dist
macos:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
prefix-key: cache-dependencies-macos
# We need to somehow get the SQLX_OFFLINE env variable into the container.
# Since `maturin-action` doesn't enable us to do that, we have to tell cargo
# via its configuration.
- name: Create fake .cargo/config.toml
run: |
mkdir -p .cargo
echo -e "[env]\nSQLX_OFFLINE = \"true\"" >> .cargo/config.toml
- uses: messense/maturin-action@v1
with:
command: build
args: --release -o dist --target universal2-apple-darwin --interpreter python${{ matrix.python-version }} --manifest-path pyauditor/Cargo.toml
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: mac-wheel-${{ matrix.python-version }}
path: dist