Skip to content

Commit d1edf63

Browse files
authored
Merge pull request #23 from MatrixAI/feature-keysanditerator
Fix Iterator KeyPath and Enable Iterator keyAsBuffer and valueAsBuffer
2 parents 9fa05be + 934796f commit d1edf63

34 files changed

+4180
-4192
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request_target:
6+
types: [opened, synchronize, reopened]
7+
8+
name: CodeSee Map
9+
10+
jobs:
11+
test_map_action:
12+
runs-on: ubuntu-latest
13+
continue-on-error: true
14+
name: Run CodeSee Map Analysis
15+
steps:
16+
- name: checkout
17+
id: checkout
18+
uses: actions/checkout@v2
19+
with:
20+
repository: ${{ github.event.pull_request.head.repo.full_name }}
21+
ref: ${{ github.event.pull_request.head.ref }}
22+
fetch-depth: 0
23+
24+
# codesee-detect-languages has an output with id languages.
25+
- name: Detect Languages
26+
id: detect-languages
27+
uses: Codesee-io/codesee-detect-languages-action@latest
28+
29+
- name: Configure JDK 16
30+
uses: actions/setup-java@v2
31+
if: ${{ fromJSON(steps.detect-languages.outputs.languages).java }}
32+
with:
33+
java-version: '16'
34+
distribution: 'zulu'
35+
36+
# CodeSee Maps Go support uses a static binary so there's no setup step required.
37+
38+
- name: Configure Node.js 14
39+
uses: actions/setup-node@v2
40+
if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }}
41+
with:
42+
node-version: '14'
43+
44+
- name: Configure Python 3.x
45+
uses: actions/setup-python@v2
46+
if: ${{ fromJSON(steps.detect-languages.outputs.languages).python }}
47+
with:
48+
python-version: '3.10'
49+
architecture: 'x64'
50+
51+
- name: Configure Ruby '3.x'
52+
uses: ruby/setup-ruby@v1
53+
if: ${{ fromJSON(steps.detect-languages.outputs.languages).ruby }}
54+
with:
55+
ruby-version: '3.0'
56+
57+
# We need the rust toolchain because it uses rustc and cargo to inspect the package
58+
- name: Configure Rust 1.x stable
59+
uses: actions-rs/toolchain@v1
60+
if: ${{ fromJSON(steps.detect-languages.outputs.languages).rust }}
61+
with:
62+
toolchain: stable
63+
64+
- name: Generate Map
65+
id: generate-map
66+
uses: Codesee-io/codesee-map-action@latest
67+
with:
68+
step: map
69+
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
70+
github_ref: ${{ github.ref }}
71+
languages: ${{ steps.detect-languages.outputs.languages }}
72+
73+
- name: Upload Map
74+
id: upload-map
75+
uses: Codesee-io/codesee-map-action@latest
76+
with:
77+
step: mapUpload
78+
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
79+
github_ref: ${{ github.ref }}
80+
81+
- name: Insights
82+
id: insights
83+
uses: Codesee-io/codesee-map-action@latest
84+
with:
85+
step: insights
86+
api_token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }}
87+
github_ref: ${{ github.ref }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
/dist
33
.env*
44
!.env.example
5+
# nix
56
/result*
7+
/builds
8+
# node-gyp
9+
/build
10+
# prebuildify
11+
/prebuilds
612

713
# Logs
814
logs

.gitlab-ci.yml

Lines changed: 223 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,245 @@
1+
workflow:
2+
rules:
3+
# Disable merge request pipelines
4+
- if: $CI_MERGE_REQUEST_ID
5+
when: never
6+
- when: always
7+
18
default:
29
interruptible: true
310

411
variables:
12+
GH_PROJECT_PATH: "MatrixAI/${CI_PROJECT_NAME}"
13+
GH_PROJECT_URL: "https://${GITHUB_TOKEN}@github.com/${GH_PROJECT_PATH}.git"
514
GIT_SUBMODULE_STRATEGY: recursive
15+
# Cache .npm
16+
NPM_CONFIG_CACHE: "${CI_PROJECT_DIR}/tmp/npm"
17+
# Prefer offline node module installation
18+
NPM_CONFIG_PREFER_OFFLINE: "true"
19+
# `ts-node` has its own cache
20+
TS_CACHED_TRANSPILE_CACHE: "${CI_PROJECT_DIR}/tmp/ts-node-cache"
21+
TS_CACHED_TRANSPILE_PORTABLE: "true"
22+
# Homebrew cache only used by macos runner
23+
HOMEBREW_CACHE: "${CI_PROJECT_DIR}/tmp/Homebrew"
24+
25+
# Cached directories shared between jobs & pipelines per-branch per-runner
26+
cache:
27+
key: $CI_COMMIT_REF_SLUG
28+
paths:
29+
- ./tmp/npm/
30+
- ./tmp/ts-node-cache/
31+
# Homebrew cache is only used by the macos runner
32+
- ./tmp/Homebrew
33+
# `jest` cache is configured in jest.config.js
34+
- ./tmp/jest/
635

736
stages:
8-
- check
37+
- check # Linting, unit tests
38+
- build # Cross-platform library compilation, unit tests
39+
- integration # Cross-platform application bundling, integration tests, and pre-release
40+
- release # Cross-platform distribution and deployment
941

1042
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
1143

12-
lint:
44+
check:lint:
1345
stage: check
14-
interruptible: true
46+
needs: []
1547
script:
1648
- >
1749
nix-shell --run '
1850
npm run lint;
1951
'
52+
rules:
53+
# Runs on feature and staging commits and ignores version commits
54+
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
55+
# Runs on tag pipeline where the tag is a prerelease or release version
56+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
57+
# Manually run on commits other than master and ignore version commits
58+
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
59+
when: manual
2060

21-
test:
61+
check:nix-dry:
2262
stage: check
23-
interruptible: true
63+
needs: []
64+
script:
65+
- nix-build -v -v --dry-run ./release.nix
66+
rules:
67+
# Runs on feature and staging commits and ignores version commits
68+
- if: $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
69+
# Runs on tag pipeline where the tag is a prerelease or release version
70+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
71+
# Manually run on commits other than master and ignore version commits
72+
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
73+
when: manual
74+
75+
check:test:
76+
stage: check
77+
needs: []
78+
script:
79+
- >
80+
nix-shell --run '
81+
npm run build --verbose;
82+
npm test -- --ci;
83+
'
84+
artifacts:
85+
when: always
86+
reports:
87+
junit:
88+
- ./tmp/junit.xml
89+
rules:
90+
# Runs on staging commits and ignores version commits
91+
- if: $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
92+
# Manually run on commits other than master and staging and ignore version commits
93+
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH !~ /^(?:master|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
94+
when: manual
95+
96+
build:merge:
97+
stage: build
98+
needs: []
99+
allow_failure: true
100+
script:
101+
# Required for `gh pr create`
102+
- git remote add upstream "$GH_PROJECT_URL"
103+
- >
104+
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
105+
gh pr create \
106+
--head staging \
107+
--base master \
108+
--title "ci: merge staging to master" \
109+
--body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
110+
--assignee "@me" \
111+
--no-maintainer-edit \
112+
--repo "$GH_PROJECT_PATH" || true;
113+
printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
114+
| gh pr comment staging \
115+
--body-file - \
116+
--repo "$GH_PROJECT_PATH";
117+
'
118+
rules:
119+
# Runs on staging commits and ignores version commits
120+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
121+
# Runs on tag pipeline where the tag is a prerelease or release version
122+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
123+
124+
build:linux:
125+
stage: build
126+
needs:
127+
- job: check:lint
128+
optional: true
24129
script:
25130
- >
26131
nix-shell --run '
27-
npm run test;
132+
npm run build --verbose;
133+
npm test -- --ci;
134+
'
135+
artifacts:
136+
when: always
137+
reports:
138+
junit:
139+
- ./tmp/junit.xml
140+
paths:
141+
- ./prebuilds/
142+
# Only the build:linux preserves the dist
143+
- ./dist
144+
rules:
145+
# Runs on staging commits and ignores version commits
146+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
147+
# Runs on tag pipeline where the tag is a prerelease or release version
148+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
149+
150+
build:windows:
151+
stage: build
152+
needs:
153+
- job: check:lint
154+
optional: true
155+
tags:
156+
- windows
157+
before_script:
158+
- choco install nodejs --version=16.14.2 -y
159+
- choco install python --version=3.9.12 -y
160+
- refreshenv
161+
script:
162+
- npm config set msvs_version 2019
163+
- npm install --ignore-scripts
164+
- $env:Path = "$(npm bin);" + $env:Path
165+
- npm run build --verbose
166+
- npm test -- --ci
167+
artifacts:
168+
when: always
169+
reports:
170+
junit:
171+
- ./tmp/junit.xml
172+
paths:
173+
- ./prebuilds/
174+
rules:
175+
# Runs on staging commits and ignores version commits
176+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
177+
# Runs on tag pipeline where the tag is a prerelease or release version
178+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
179+
180+
build:macos:
181+
stage: build
182+
needs:
183+
- job: check:lint
184+
optional: true
185+
tags:
186+
- shared-macos-amd64
187+
image: macos-11-xcode-12
188+
variables:
189+
HOMEBREW_NO_INSTALL_UPGRADE: "true"
190+
HOMEBREW_NO_INSTALL_CLEANUP: "true"
191+
before_script:
192+
- brew install node@16
193+
- brew link --overwrite node@16
194+
- brew install [email protected]
195+
- brew link --overwrite [email protected]
196+
- hash -r
197+
script:
198+
- npm install --ignore-scripts
199+
- export PATH="$(npm bin):$PATH"
200+
- export PREBUILD_ARCH=x64+arm64
201+
- npm run build --verbose
202+
- npm test -- --ci
203+
artifacts:
204+
when: always
205+
reports:
206+
junit:
207+
- ./tmp/junit.xml
208+
paths:
209+
- ./prebuilds/
210+
rules:
211+
# Runs on staging commits and ignores version commits
212+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
213+
# Runs on tag pipeline where the tag is a prerelease or release version
214+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
215+
216+
integration:merge:
217+
stage: integration
218+
needs:
219+
- build:merge
220+
# Requires mutual exclusion
221+
resource_group: integration:merge
222+
allow_failure: true
223+
variables:
224+
# Ensure that CI/CD is fetching all commits
225+
# this is necessary to checkout origin/master
226+
# and to also merge origin/staging
227+
GIT_DEPTH: 0
228+
script:
229+
- >
230+
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
231+
printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
232+
| gh pr comment staging \
233+
--body-file - \
234+
--repo "$GH_PROJECT_PATH";
28235
'
236+
- git remote add upstream "$GH_PROJECT_URL"
237+
- git checkout origin/master
238+
# Merge up to the current commit (not the latest commit)
239+
- git merge --ff-only "$CI_COMMIT_SHA"
240+
- git push upstream HEAD:master
241+
rules:
242+
# Runs on staging commits and ignores version commits
243+
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
244+
# Runs on tag pipeline where the tag is a prerelease or release version
245+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/

.npmignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
.*
2+
/*.nix
23
/nix
3-
/pkgs.nix
4-
/default.nix
5-
/shell.nix
6-
/release.nix
74
/tsconfig.json
85
/tsconfig.build.json
96
/jest.config.js
7+
/scripts
108
/src
119
/tests
1210
/tmp
1311
/docs
1412
/benches
13+
/build
14+
/builds
1515
/dist/tsbuildinfo

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ npm run lintfix
3535
npm run bench
3636
```
3737

38-
View benchmarks here: https://github.com/MatrixAI/js-db/blob/master/benches/results/WorkerManager.chart.html with https://raw.githack.com/
38+
View benchmarks here: https://github.com/MatrixAI/js-db/blob/master/benches/results with https://raw.githack.com/
3939

4040
### Docs Generation
4141

0 commit comments

Comments
 (0)