-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-enable automatic upload to pypi (#2034)
* Re-enable automatic upload to pypi * Add test against tiledb:// --------- Co-authored-by: Agisilaos Kounelis <[email protected]>
- Loading branch information
1 parent
a1b6335
commit a6e1249
Showing
3 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,9 @@ on: | |
|
||
env: | ||
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB: ${{ inputs.version }} | ||
S3_BUCKET: ${{ vars.S3_BUCKET }} | ||
TILEDB_NAMESPACE: ${{ vars.TILEDB_NAMESPACE }} | ||
TILEDB_TOKEN: ${{ secrets.TILEDB_TOKEN }} | ||
|
||
jobs: | ||
build_wheels: | ||
|
@@ -46,7 +49,7 @@ jobs: | |
uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD_VERBOSITY: 3 | ||
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB | ||
CIBW_ENVIRONMENT_PASS_LINUX: SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TILEDB S3_BUCKET TILEDB_TOKEN TILEDB_NAMESPACE | ||
CIBW_ENVIRONMENT_MACOS: > | ||
CC=clang | ||
CXX=clang++ | ||
|
@@ -155,6 +158,6 @@ jobs: | |
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
# - name: Upload to pypi | ||
# if: startsWith(github.ref, 'refs/tags/') | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Upload to pypi | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import datetime | ||
import os | ||
import random | ||
import string | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
import tiledb | ||
from tiledb.tests.common import DiskTestCase | ||
|
||
tiledb_token = os.getenv("TILEDB_TOKEN") | ||
tiledb_namespace = os.getenv("TILEDB_NAMESPACE") | ||
s3_bucket = os.getenv("S3_BUCKET") | ||
|
||
|
||
@pytest.mark.skipif( | ||
not os.getenv("CI") and tiledb_token is None, | ||
reason="No token was provided in a non-CI environment. Please set the TILEDB_TOKEN environment variable to run this test.", | ||
) | ||
class CloudTest(DiskTestCase): | ||
def test_save_and_open_array_from_cloud(self): | ||
config = tiledb.Config({"rest.token": tiledb_token}) | ||
ctx = tiledb.Ctx(config=config) | ||
|
||
# Useful to include the datetime in the array name to handle multiple consecutive runs of the test. | ||
# Random letters are added to the end to ensure that conflicts are avoided, especially in CI environments where multiple tests may run in parallel. | ||
array_name = ( | ||
datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S") | ||
+ "-" | ||
+ "".join(random.choice(string.ascii_letters) for _ in range(5)) | ||
) | ||
uri = f"tiledb://{tiledb_namespace}/s3://{s3_bucket}/{array_name}" | ||
|
||
with tiledb.from_numpy(uri, np.random.rand(3, 2), ctx=ctx) as T: | ||
self.assertTrue(tiledb.array_exists(uri, ctx=ctx)) | ||
self.assertTrue( | ||
T.schema | ||
== tiledb.ArraySchema( | ||
domain=tiledb.Domain( | ||
tiledb.Dim( | ||
name="__dim_0", | ||
domain=(0, 2), | ||
tile=3, | ||
dtype="uint64", | ||
filters=tiledb.FilterList([tiledb.ZstdFilter(level=-1)]), | ||
), | ||
tiledb.Dim( | ||
name="__dim_1", | ||
domain=(0, 1), | ||
tile=2, | ||
dtype="uint64", | ||
filters=tiledb.FilterList([tiledb.ZstdFilter(level=-1)]), | ||
), | ||
), | ||
attrs=[ | ||
tiledb.Attr( | ||
name="", | ||
dtype="float64", | ||
var=False, | ||
nullable=False, | ||
enum_label=None, | ||
), | ||
], | ||
cell_order="row-major", | ||
tile_order="row-major", | ||
sparse=False, | ||
) | ||
) | ||
|
||
tiledb.Array.delete_array(uri, ctx=ctx) |