-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (158 loc) · 5.43 KB
/
storage-aws-tests.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Lints-Tests
on:
push:
branches:
- main
- master
pull_request:
permissions:
contents: read
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
CLOUD_BUCKET_NAME: "${{ secrets.CLOUD_BUCKET_NAME }}"
AWS_REGION: "${{ secrets.AWS_REGION }}"
PYTHON_VERSION: "3.11"
PACKAGE_NAME: "opsml_storage_s3"
MODULE_NAME: "PyS3FSStorageClient"
jobs:
rust-lints-test:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Set up Rust
run: rustup override set stable && rustup update
- name: Install clippy
run: rustup component add clippy
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
working-directory: ./crates/opsml_storage
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Tests
working-directory: ./crates/opsml_storage
run: make test.aws
env:
RUST_BACKTRACE: 1
test-os:
name: test ${{ matrix.os }}-${{ matrix.python-version }}
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}-latest
needs: [rust-lints-test]
steps:
- uses: actions/checkout@v4
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
#- uses: "google-github-actions/auth@v2"
#with:
#project_id: ${{ env.GCP_PROJECT_ID }}
#workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
#- name: "Set up Cloud SDK"
#uses: "google-github-actions/setup-gcloud@v2"
#- name: "Use gcloud CLI"
#run: "gcloud info"
- name: install rust stable
uses: dtolnay/rust-toolchain@stable
- name: cache rust
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.python-version }}-v1
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
working-directory: ./opsml_storage_s3
run: make setup.project
- name: Lints
working-directory: ./opsml_storage_s3
run: make lints.ci
- name: Run tests and report coverage
working-directory: ./opsml_storage_s3
run: make test.unit
test-macos-aarch64-build:
runs-on: macos-14
needs: [rust-lints-test]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: arm64
- name: "Build wheels - aarch64"
uses: PyO3/maturin-action@v1
with:
target: aarch64
args: --release --locked --out dist --interpreter ${{ env.PYTHON_VERSION }}
rust-toolchain: stable
working-directory: ./opsml_storage_s3
- name: "Test wheel - aarch64"
run: |
WHEEL_FILE=$(ls dist/${{ env.PACKAGE_NAME }}-*.whl)
pip install $WHEEL_FILE --force-reinstall
python -c "import ${env.MODULE_NAME}"
test-linux-build:
runs-on: ubuntu-latest
needs: [rust-lints-test]
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: "Build wheels"
uses: PyO3/maturin-action@v1
with:
rust-toolchain: stable
working-directory: ./opsml_storage_s3
target: ${{ matrix.target }}
manylinux: auto
args: --release --locked --out dist --interpreter ${{ env.PYTHON_VERSION }}
# See: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145
before-script-linux: |
# If we're running on rhel centos, install needed packages.
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
# If we're running on i686 we need to symlink libatomic
# in order to build openssl with -latomic flag.
if [[ ! -d "/usr/lib64" ]]; then
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
fi
else
# If we're running on debian-based system.
apt update -y && apt-get install -y libssl-dev openssl pkg-config
fi
- name: "Test wheel"
if: ${{ startsWith(matrix.target, 'x86_64') }}
run: |
WHEEL_FILE=$(ls dist/${{ env.PACKAGE_NAME }}-*.whl)
pip install $WHEEL_FILE --force-reinstall
python -c "import ${env.MODULE_NAME}"