lamindb_setup 1.9.1__tar.gz → 1.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/.github/workflows/build.yml +241 -241
  2. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/.gitignore +112 -112
  3. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/.pre-commit-config.yaml +46 -46
  4. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/PKG-INFO +3 -3
  5. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/README.md +6 -6
  6. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/01-init-local-instance.ipynb +132 -132
  7. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/02-connect-local-instance.ipynb +180 -180
  8. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/03-add-managed-storage.ipynb +532 -532
  9. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/04-test-bionty.ipynb +159 -159
  10. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/05-init-hosted-instance.ipynb +159 -159
  11. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/06-connect-hosted-instance.ipynb +232 -232
  12. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/07-keep-artifacts-local.ipynb +266 -266
  13. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/08-test-multi-session.ipynb +184 -204
  14. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-cache-management.ipynb +405 -405
  15. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-cloud-sync.ipynb +863 -863
  16. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-connect-anonymously.ipynb +88 -88
  17. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-empty-init.ipynb +126 -126
  18. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-init-load-local-anonymously.ipynb +140 -140
  19. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-insufficient-user-info.ipynb +1 -11
  20. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/__init__.py +107 -107
  21. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_cache.py +87 -87
  22. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_check_setup.py +192 -166
  23. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_connect_instance.py +415 -328
  24. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_delete.py +144 -141
  25. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_disconnect.py +35 -32
  26. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_init_instance.py +430 -440
  27. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_migrate.py +278 -266
  28. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_register_instance.py +32 -35
  29. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_schema_metadata.py +441 -441
  30. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_set_managed_storage.py +69 -70
  31. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_setup_user.py +172 -133
  32. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/__init__.py +21 -21
  33. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_aws_options.py +223 -223
  34. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_aws_storage.py +9 -1
  35. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_hub_client.py +248 -248
  36. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_hub_core.py +728 -665
  37. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_hub_crud.py +227 -227
  38. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_private_django_api.py +83 -83
  39. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings.py +384 -377
  40. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings_instance.py +577 -569
  41. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings_load.py +141 -141
  42. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings_save.py +95 -95
  43. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings_storage.py +427 -429
  44. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings_store.py +91 -91
  45. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_settings_user.py +55 -55
  46. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_setup_bionty_sources.py +44 -44
  47. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/cloud_sqlite_locker.py +240 -240
  48. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/django.py +315 -305
  49. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/exceptions.py +1 -1
  50. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/hashing.py +134 -134
  51. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/types.py +1 -1
  52. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/upath.py +1013 -1013
  53. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/errors.py +80 -70
  54. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/types.py +20 -20
  55. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/noxfile.py +117 -117
  56. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/pyproject.toml +154 -154
  57. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +26 -26
  58. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_connect_instance.py +159 -163
  59. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_edge_request.py +63 -63
  60. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_init_instance.py +218 -217
  61. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_init_pass_user_no_writes.py +47 -47
  62. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_login.py +5 -2
  63. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-local/conftest.py +29 -29
  64. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-local/scripts/script-connect-fine-grained-access.py +65 -65
  65. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-local/test_all.py +466 -459
  66. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-local/test_update_schema_in_hub.py +244 -244
  67. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-prod/conftest.py +24 -24
  68. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-prod/test_global_settings.py +80 -80
  69. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-prod/test_upath.py +79 -79
  70. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_storage_access.py +61 -61
  71. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_storage_stats.py +92 -92
  72. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_to_url.py +32 -32
  73. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/.github/workflows/doc-changes.yml +0 -0
  74. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/LICENSE +0 -0
  75. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/changelog.md +0 -0
  76. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-cloud/test_notebooks.py +0 -0
  77. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-import-schema.ipynb +0 -0
  78. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
  79. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
  80. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/hub-prod/test_notebooks2.py +0 -0
  81. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/index.md +0 -0
  82. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/notebooks.md +0 -0
  83. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/docs/reference.md +0 -0
  84. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_check.py +0 -0
  85. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_django.py +0 -0
  86. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_entry_points.py +0 -0
  87. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_exportdb.py +0 -0
  88. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_importdb.py +0 -0
  89. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_schema.py +0 -0
  90. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/_silence_loggers.py +0 -0
  91. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_deprecated.py +0 -0
  92. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_docs.py +0 -0
  93. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/core/_hub_utils.py +0 -0
  94. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/lamindb_setup/py.typed +0 -0
  95. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
  96. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_delete_instance.py +0 -0
  97. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
  98. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_migrate.py +0 -0
  99. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-cloud/test_set_storage.py +0 -0
  100. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-prod/test_aws_options_manager.py +0 -0
  101. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-prod/test_django.py +0 -0
  102. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
  103. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_entry_point.py +0 -0
  104. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_hashing.py +0 -0
  105. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_storage_basis.py +0 -0
  106. {lamindb_setup-1.9.1 → lamindb_setup-1.10.0}/tests/storage/test_storage_settings.py +0 -0
@@ -1,241 +1,241 @@
1
- name: build
2
-
3
- on:
4
- push:
5
- branches: [main, staging]
6
- pull_request:
7
- branches: [main]
8
- repository_dispatch:
9
- types: [build]
10
-
11
- jobs:
12
- # tests only on production hub
13
- hub-prod:
14
- runs-on: ubuntu-latest
15
- timeout-minutes: 12
16
- steps:
17
- - uses: actions/checkout@v4
18
- - uses: actions/setup-python@v5
19
- with:
20
- python-version: "3.10"
21
- cache: "pip"
22
- - uses: aws-actions/configure-aws-credentials@v4
23
- with:
24
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
25
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26
- aws-region: eu-central-1
27
- - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
28
- - run: nox -s "install(group='hub-prod')"
29
- - run: nox -s "build(lamin_env='prod', group='hub-prod')"
30
- - uses: actions/upload-artifact@v4
31
- with:
32
- name: coverage--hub-prod
33
- path: .coverage
34
- include-hidden-files: true
35
-
36
- # tests both on production and staging hub
37
- hub-cloud:
38
- runs-on: ubuntu-latest
39
- strategy:
40
- fail-fast: false
41
- matrix:
42
- include:
43
- - lamin_env: "prod"
44
- python-version: "3.11"
45
- - lamin_env: "staging"
46
- python-version: "3.10"
47
- timeout-minutes: 12
48
- steps:
49
- - uses: aws-actions/configure-aws-credentials@v4
50
- with:
51
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
52
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
53
- aws-region: eu-central-1
54
- - uses: actions/checkout@v4
55
- - uses: actions/setup-python@v4
56
- with:
57
- python-version: ${{ matrix.python-version }}
58
- cache: "pip"
59
- cache-dependency-path: ".github/workflows/build.yml"
60
- - uses: actions/checkout@v4
61
- with:
62
- repository: laminlabs/laminhub
63
- token: ${{ secrets.GH_TOKEN_DEPLOY_LAMINAPP }}
64
- path: laminhub
65
- ref: main
66
- - uses: actions/cache@v4
67
- with:
68
- path: ~/.cache/pre-commit
69
- key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
70
- - id: cache-postgres
71
- uses: actions/cache@v4
72
- with:
73
- path: ~/postgres.tar
74
- key: cache-postgres-0
75
- - if: steps.cache-postgres.outputs.cache-hit != 'true'
76
- run: docker pull postgres:latest && docker image save postgres:latest --output ~/postgres.tar
77
- - if: steps.cache-postgres.outputs.cache-hit == 'true'
78
- run: docker image load --input ~/postgres.tar
79
- - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
80
- # account for in a different job
81
- # - uses: "google-github-actions/auth@v0"
82
- # with:
83
- # credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
84
- # - uses: "google-github-actions/setup-gcloud@v0"
85
- - run: nox -s "install(group='hub-cloud')"
86
- - run: nox -s "build(lamin_env='${{ matrix.lamin_env }}', group='hub-cloud')"
87
- - uses: actions/upload-artifact@v4
88
- if: ${{ matrix.lamin_env == 'prod' }}
89
- with:
90
- name: coverage--hub-cloud
91
- path: .coverage
92
- include-hidden-files: true
93
-
94
- # test user access to storage
95
- storage:
96
- runs-on: ubuntu-latest
97
- timeout-minutes: 12
98
- steps:
99
- - uses: actions/checkout@v4
100
- - uses: actions/setup-python@v5
101
- with:
102
- python-version: "3.10"
103
- cache: "pip"
104
- cache-dependency-path: ".github/workflows/build.yml"
105
- - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
106
- - run: nox -s "install(group='storage')"
107
- - run: nox -s lint
108
- - run: nox -s storage
109
- env:
110
- TEST_INSTANCE_PRIVATE_POSTGRES: ${{ secrets.TEST_INSTANCE_PRIVATE_POSTGRES }}
111
- TMP_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
112
- TMP_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
113
- - uses: actions/upload-artifact@v4
114
- with:
115
- name: coverage--storage
116
- path: .coverage
117
- include-hidden-files: true
118
-
119
- # test low-level hub functionality
120
- hub-local:
121
- runs-on: ubuntu-latest
122
- timeout-minutes: 12
123
- steps:
124
- - uses: aws-actions/configure-aws-credentials@v4
125
- with:
126
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
127
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
128
- aws-region: eu-central-1
129
- - uses: actions/checkout@v4
130
- - uses: actions/checkout@v4
131
- with:
132
- repository: laminlabs/laminhub
133
- token: ${{ secrets.GH_TOKEN_DEPLOY_LAMINAPP }}
134
- path: laminhub
135
- ref: main
136
- - name: Set env file for local test of edge functions
137
- run: |
138
- touch .env.local
139
- echo "AWS_ACCESS_KEY_ID_HOSTED_S3=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env.local
140
- echo "AWS_SECRET_ACCESS_KEY_HOSTED_S3=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env.local
141
- working-directory: laminhub/rest-hub/supabase
142
- - uses: actions/setup-python@v4
143
- with:
144
- python-version: "3.11" # we need to run everything for coverage on 3.11
145
- cache: "pip"
146
- cache-dependency-path: ".github/workflows/build.yml"
147
- - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
148
- - run: nox -s "install(group='hub-local')"
149
- - id: cache-supabase
150
- uses: actions/cache@v4
151
- with:
152
- path: /var/lib/docker
153
- key: cache-supabase
154
- - uses: supabase/setup-cli@v1
155
- with:
156
- version: "2.6.8"
157
- - run: nox -s hub_local
158
- env:
159
- LAMIN_ENV: "local"
160
- - uses: actions/upload-artifact@v4
161
- with:
162
- name: coverage--hub-local
163
- path: .coverage
164
- include-hidden-files: true
165
-
166
- coverage:
167
- needs: [hub-prod, hub-cloud, storage, hub-local]
168
- runs-on: ubuntu-latest
169
- steps:
170
- - uses: actions/checkout@v4
171
- - uses: actions/setup-python@v4
172
- with:
173
- python-version: "3.11"
174
- cache: "pip"
175
- - run: |
176
- pip install coverage[toml]
177
- pip install --no-deps .
178
- - uses: actions/download-artifact@v4
179
- - name: run coverage
180
- run: |
181
- coverage combine coverage--*/.coverage*
182
- coverage report --fail-under=0
183
- coverage xml
184
- - uses: codecov/codecov-action@v2
185
- with:
186
- token: ${{ secrets.CODECOV_TOKEN }}
187
-
188
- docs:
189
- needs: hub-cloud
190
- runs-on: ubuntu-latest
191
- steps:
192
- - uses: aws-actions/configure-aws-credentials@v4
193
- with:
194
- aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
195
- aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
196
- aws-region: eu-central-1
197
- - uses: actions/checkout@v4
198
- with:
199
- submodules: recursive
200
- fetch-depth: 0
201
- - name: checkout lndocs
202
- uses: actions/checkout@v4
203
- with:
204
- repository: laminlabs/lndocs
205
- ssh-key: ${{ secrets.READ_LNDOCS }}
206
- path: lndocs
207
- ref: main
208
- - uses: actions/setup-python@v5
209
- with:
210
- python-version: "3.10"
211
- cache: "pip"
212
- cache-dependency-path: ".github/workflows/build.yml"
213
- - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
214
- - run: nox -s "install(group='docs')"
215
- - uses: actions/download-artifact@v4
216
- - run: nox -s docs
217
- - uses: nwtgck/actions-netlify@v1.2
218
- with:
219
- publish-dir: "_build/html"
220
- production-deploy: ${{ github.event_name == 'push' }}
221
- github-token: ${{ secrets.GITHUB_TOKEN }}
222
- enable-commit-comment: false
223
- env:
224
- NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
225
- NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
226
-
227
- notify:
228
- if: always()
229
- # this here is only for notifying developers of laminhub
230
- # hence, it only needs groups hub-local and hub-cloud
231
- needs: [hub-local, hub-cloud]
232
- runs-on: ubuntu-latest
233
- steps:
234
- - uses: voxmedia/github-action-slack-notify-build@v1
235
- if: ${{ ( needs.hub-local.result == 'failure' || needs.hub-cloud.result == 'failure' ) && github.event_name == 'repository_dispatch' }}
236
- env:
237
- SLACK_BOT_TOKEN: ${{ secrets.SLACK_GITHUB_ACTION }}
238
- with:
239
- channel_id: C05S2C02JHM
240
- status: FAILURE
241
- color: danger
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches: [main, staging]
6
+ pull_request:
7
+ branches: [main]
8
+ repository_dispatch:
9
+ types: [build]
10
+
11
+ jobs:
12
+ # tests only on production hub
13
+ hub-prod:
14
+ runs-on: ubuntu-latest
15
+ timeout-minutes: 12
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.10"
21
+ cache: "pip"
22
+ - uses: aws-actions/configure-aws-credentials@v4
23
+ with:
24
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
25
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26
+ aws-region: eu-central-1
27
+ - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
28
+ - run: nox -s "install(group='hub-prod')"
29
+ - run: nox -s "build(lamin_env='prod', group='hub-prod')"
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: coverage--hub-prod
33
+ path: .coverage
34
+ include-hidden-files: true
35
+
36
+ # tests both on production and staging hub
37
+ hub-cloud:
38
+ runs-on: ubuntu-latest
39
+ strategy:
40
+ fail-fast: false
41
+ matrix:
42
+ include:
43
+ - lamin_env: "prod"
44
+ python-version: "3.11"
45
+ - lamin_env: "staging"
46
+ python-version: "3.10"
47
+ timeout-minutes: 12
48
+ steps:
49
+ - uses: aws-actions/configure-aws-credentials@v4
50
+ with:
51
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
52
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
53
+ aws-region: eu-central-1
54
+ - uses: actions/checkout@v4
55
+ - uses: actions/setup-python@v4
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+ cache: "pip"
59
+ cache-dependency-path: ".github/workflows/build.yml"
60
+ - uses: actions/checkout@v4
61
+ with:
62
+ repository: laminlabs/laminhub
63
+ token: ${{ secrets.GH_TOKEN_DEPLOY_LAMINAPP }}
64
+ path: laminhub
65
+ ref: main
66
+ - uses: actions/cache@v4
67
+ with:
68
+ path: ~/.cache/pre-commit
69
+ key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
70
+ - id: cache-postgres
71
+ uses: actions/cache@v4
72
+ with:
73
+ path: ~/postgres.tar
74
+ key: cache-postgres-0
75
+ - if: steps.cache-postgres.outputs.cache-hit != 'true'
76
+ run: docker pull postgres:latest && docker image save postgres:latest --output ~/postgres.tar
77
+ - if: steps.cache-postgres.outputs.cache-hit == 'true'
78
+ run: docker image load --input ~/postgres.tar
79
+ - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
80
+ # account for in a different job
81
+ # - uses: "google-github-actions/auth@v0"
82
+ # with:
83
+ # credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
84
+ # - uses: "google-github-actions/setup-gcloud@v0"
85
+ - run: nox -s "install(group='hub-cloud')"
86
+ - run: nox -s "build(lamin_env='${{ matrix.lamin_env }}', group='hub-cloud')"
87
+ - uses: actions/upload-artifact@v4
88
+ if: ${{ matrix.lamin_env == 'prod' }}
89
+ with:
90
+ name: coverage--hub-cloud
91
+ path: .coverage
92
+ include-hidden-files: true
93
+
94
+ # test user access to storage
95
+ storage:
96
+ runs-on: ubuntu-latest
97
+ timeout-minutes: 12
98
+ steps:
99
+ - uses: actions/checkout@v4
100
+ - uses: actions/setup-python@v5
101
+ with:
102
+ python-version: "3.10"
103
+ cache: "pip"
104
+ cache-dependency-path: ".github/workflows/build.yml"
105
+ - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
106
+ - run: nox -s "install(group='storage')"
107
+ - run: nox -s lint
108
+ - run: nox -s storage
109
+ env:
110
+ TEST_INSTANCE_PRIVATE_POSTGRES: ${{ secrets.TEST_INSTANCE_PRIVATE_POSTGRES }}
111
+ TMP_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
112
+ TMP_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
113
+ - uses: actions/upload-artifact@v4
114
+ with:
115
+ name: coverage--storage
116
+ path: .coverage
117
+ include-hidden-files: true
118
+
119
+ # test low-level hub functionality
120
+ hub-local:
121
+ runs-on: ubuntu-latest
122
+ timeout-minutes: 12
123
+ steps:
124
+ - uses: aws-actions/configure-aws-credentials@v4
125
+ with:
126
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
127
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
128
+ aws-region: eu-central-1
129
+ - uses: actions/checkout@v4
130
+ - uses: actions/checkout@v4
131
+ with:
132
+ repository: laminlabs/laminhub
133
+ token: ${{ secrets.GH_TOKEN_DEPLOY_LAMINAPP }}
134
+ path: laminhub
135
+ ref: main
136
+ - name: Set env file for local test of edge functions
137
+ run: |
138
+ touch .env.local
139
+ echo "AWS_ACCESS_KEY_ID_HOSTED_S3=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env.local
140
+ echo "AWS_SECRET_ACCESS_KEY_HOSTED_S3=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env.local
141
+ working-directory: laminhub/rest-hub/supabase
142
+ - uses: actions/setup-python@v4
143
+ with:
144
+ python-version: "3.11" # we need to run everything for coverage on 3.11
145
+ cache: "pip"
146
+ cache-dependency-path: ".github/workflows/build.yml"
147
+ - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
148
+ - run: nox -s "install(group='hub-local')"
149
+ - id: cache-supabase
150
+ uses: actions/cache@v4
151
+ with:
152
+ path: /var/lib/docker
153
+ key: cache-supabase
154
+ - uses: supabase/setup-cli@v1
155
+ with:
156
+ version: "2.6.8"
157
+ - run: nox -s hub_local
158
+ env:
159
+ LAMIN_ENV: "local"
160
+ - uses: actions/upload-artifact@v4
161
+ with:
162
+ name: coverage--hub-local
163
+ path: .coverage
164
+ include-hidden-files: true
165
+
166
+ coverage:
167
+ needs: [hub-prod, hub-cloud, storage, hub-local]
168
+ runs-on: ubuntu-latest
169
+ steps:
170
+ - uses: actions/checkout@v4
171
+ - uses: actions/setup-python@v4
172
+ with:
173
+ python-version: "3.11"
174
+ cache: "pip"
175
+ - run: |
176
+ pip install coverage[toml]
177
+ pip install --no-deps .
178
+ - uses: actions/download-artifact@v4
179
+ - name: run coverage
180
+ run: |
181
+ coverage combine coverage--*/.coverage*
182
+ coverage report --fail-under=0
183
+ coverage xml
184
+ - uses: codecov/codecov-action@v2
185
+ with:
186
+ token: ${{ secrets.CODECOV_TOKEN }}
187
+
188
+ docs:
189
+ needs: hub-cloud
190
+ runs-on: ubuntu-latest
191
+ steps:
192
+ - uses: aws-actions/configure-aws-credentials@v4
193
+ with:
194
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
195
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
196
+ aws-region: eu-central-1
197
+ - uses: actions/checkout@v4
198
+ with:
199
+ submodules: recursive
200
+ fetch-depth: 0
201
+ - name: checkout lndocs
202
+ uses: actions/checkout@v4
203
+ with:
204
+ repository: laminlabs/lndocs
205
+ ssh-key: ${{ secrets.READ_LNDOCS }}
206
+ path: lndocs
207
+ ref: main
208
+ - uses: actions/setup-python@v5
209
+ with:
210
+ python-version: "3.10"
211
+ cache: "pip"
212
+ cache-dependency-path: ".github/workflows/build.yml"
213
+ - run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"
214
+ - run: nox -s "install(group='docs')"
215
+ - uses: actions/download-artifact@v4
216
+ - run: nox -s docs
217
+ - uses: nwtgck/actions-netlify@v1.2
218
+ with:
219
+ publish-dir: "_build/html"
220
+ production-deploy: ${{ github.event_name == 'push' }}
221
+ github-token: ${{ secrets.GITHUB_TOKEN }}
222
+ enable-commit-comment: false
223
+ env:
224
+ NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
225
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
226
+
227
+ notify:
228
+ if: always()
229
+ # this here is only for notifying developers of laminhub
230
+ # hence, it only needs groups hub-local and hub-cloud
231
+ needs: [hub-local, hub-cloud]
232
+ runs-on: ubuntu-latest
233
+ steps:
234
+ - uses: voxmedia/github-action-slack-notify-build@v1
235
+ if: ${{ ( needs.hub-local.result == 'failure' || needs.hub-cloud.result == 'failure' ) && github.event_name == 'repository_dispatch' }}
236
+ env:
237
+ SLACK_BOT_TOKEN: ${{ secrets.SLACK_GITHUB_ACTION }}
238
+ with:
239
+ channel_id: C05S2C02JHM
240
+ status: FAILURE
241
+ color: danger