Skip to content

Commit a6e1249

Browse files
Re-enable automatic upload to pypi (#2034)
* Re-enable automatic upload to pypi * Add test against tiledb:// --------- Co-authored-by: Agisilaos Kounelis <[email protected]>
1 parent a1b6335 commit a6e1249

File tree

3 files changed

+83
-4
lines changed

3 files changed

+83
-4
lines changed

.github/workflows/build-wheels.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818

1919
env:
2020
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB: ${{ inputs.version }}
21+
S3_BUCKET: ${{ vars.S3_BUCKET }}
22+
TILEDB_NAMESPACE: ${{ vars.TILEDB_NAMESPACE }}
23+
TILEDB_TOKEN: ${{ secrets.TILEDB_TOKEN }}
2124

2225
jobs:
2326
build_wheels:
@@ -46,7 +49,7 @@ jobs:
4649
uses: pypa/[email protected]
4750
env:
4851
CIBW_BUILD_VERBOSITY: 3
49-
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB
52+
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB S3_BUCKET TILEDB_TOKEN TILEDB_NAMESPACE
5053
CIBW_ENVIRONMENT_MACOS: >
5154
CC=clang
5255
CXX=clang++
@@ -155,6 +158,6 @@ jobs:
155158
with:
156159
repository-url: https://test.pypi.org/legacy/
157160

158-
# - name: Upload to pypi
159-
# if: startsWith(github.ref, 'refs/tags/')
160-
# uses: pypa/gh-action-pypi-publish@release/v1
161+
- name: Upload to pypi
162+
if: startsWith(github.ref, 'refs/tags/')
163+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ concurrency:
66
group: ${{ github.head_ref || github.run_id }}
77
cancel-in-progress: true
88

9+
env:
10+
S3_BUCKET: ${{ vars.S3_BUCKET }}
11+
TILEDB_NAMESPACE: ${{ vars.TILEDB_NAMESPACE }}
12+
TILEDB_TOKEN: ${{ secrets.TILEDB_TOKEN }}
13+
914
jobs:
1015
build:
1116
runs-on: ${{ matrix.os }}

tiledb/tests/test_cloud.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import datetime
2+
import os
3+
import random
4+
import string
5+
6+
import numpy as np
7+
import pytest
8+
9+
import tiledb
10+
from tiledb.tests.common import DiskTestCase
11+
12+
tiledb_token = os.getenv("TILEDB_TOKEN")
13+
tiledb_namespace = os.getenv("TILEDB_NAMESPACE")
14+
s3_bucket = os.getenv("S3_BUCKET")
15+
16+
17+
@pytest.mark.skipif(
18+
not os.getenv("CI") and tiledb_token is None,
19+
reason="No token was provided in a non-CI environment. Please set the TILEDB_TOKEN environment variable to run this test.",
20+
)
21+
class CloudTest(DiskTestCase):
22+
def test_save_and_open_array_from_cloud(self):
23+
config = tiledb.Config({"rest.token": tiledb_token})
24+
ctx = tiledb.Ctx(config=config)
25+
26+
# Useful to include the datetime in the array name to handle multiple consecutive runs of the test.
27+
# Random letters are added to the end to ensure that conflicts are avoided, especially in CI environments where multiple tests may run in parallel.
28+
array_name = (
29+
datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
30+
+ "-"
31+
+ "".join(random.choice(string.ascii_letters) for _ in range(5))
32+
)
33+
uri = f"tiledb://{tiledb_namespace}/s3://{s3_bucket}/{array_name}"
34+
35+
with tiledb.from_numpy(uri, np.random.rand(3, 2), ctx=ctx) as T:
36+
self.assertTrue(tiledb.array_exists(uri, ctx=ctx))
37+
self.assertTrue(
38+
T.schema
39+
== tiledb.ArraySchema(
40+
domain=tiledb.Domain(
41+
tiledb.Dim(
42+
name="__dim_0",
43+
domain=(0, 2),
44+
tile=3,
45+
dtype="uint64",
46+
filters=tiledb.FilterList([tiledb.ZstdFilter(level=-1)]),
47+
),
48+
tiledb.Dim(
49+
name="__dim_1",
50+
domain=(0, 1),
51+
tile=2,
52+
dtype="uint64",
53+
filters=tiledb.FilterList([tiledb.ZstdFilter(level=-1)]),
54+
),
55+
),
56+
attrs=[
57+
tiledb.Attr(
58+
name="",
59+
dtype="float64",
60+
var=False,
61+
nullable=False,
62+
enum_label=None,
63+
),
64+
],
65+
cell_order="row-major",
66+
tile_order="row-major",
67+
sparse=False,
68+
)
69+
)
70+
71+
tiledb.Array.delete_array(uri, ctx=ctx)

0 commit comments

Comments
 (0)