-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5e2f38
commit f51a9f1
Showing
221 changed files
with
50,805 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
proto/gen linguist-generated=true | ||
js/packages/proto/src/generated linguist-generated=true | ||
cargo.lock linguist-generated=true |
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
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,59 @@ | ||
name: Release VSIX Workflow | ||
on: | ||
release: | ||
types: [published] | ||
env: | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true | ||
CARGO_INCREMENTAL: 0 | ||
jobs: | ||
check-versions-match: | ||
name: Check versions match | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- name: Install jq | ||
run: sudo apt-get install jq | ||
- run: make check_versions_match | ||
upload-vsix-release: | ||
name: Upload VSIX Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- check-versions-match | ||
steps: | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
profile: minimal | ||
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # ratchet:Swatinem/rust-cache@v2 | ||
- uses: taiki-e/cache-cargo-install-action@5b024fe3a0a2c7f2aaff0e47871acf0d14b07207 # ratchet:taiki-e/cache-cargo-install-action@v1 | ||
with: | ||
tool: wasm-bindgen-cli | ||
- name: Install buf | ||
run: BIN="/usr/local/bin" && VERSION="1.31.0" && curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && chmod +x "${BIN}/buf" | ||
- run: make proto | ||
- name: Build rust wasm | ||
run: make rust_build_wasm | ||
- name: Setup Node | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # ratchet:actions/setup-node@v3 | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # ratchet:pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- name: Install dependencies | ||
run: pnpm install -r | ||
- name: Build extension | ||
run: pnpm run build_extension | ||
- name: Upload Release Asset | ||
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # ratchet:softprops/action-gh-release@v2.0.4 | ||
with: | ||
files: ./js/packages/quary-extension/quary-*.vsix | ||
- run: pnpx vsce publish --packagePath $(find ./js/packages/quary-extension/quary-*.vsix) | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} |
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,37 @@ | ||
name: rust-lint | ||
on: | ||
pull_request: | ||
paths: | ||
- 'rust/**' | ||
merge_group: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
rust-lint: | ||
name: Rust Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # ratchet:actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # ratchet:actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
components: rustfmt, clippy | ||
- name: Install buf | ||
run: BIN="/usr/local/bin" && VERSION="1.31.0" && curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" -o "${BIN}/buf" && chmod +x "${BIN}/buf" | ||
- run: make proto | ||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
- name: Run clippy | ||
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # ratchet:actions-rs/cargo@v1 | ||
with: | ||
command: clippy |
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,27 @@ | ||
FROM --platform=$BUILDPLATFORM golang:alpine AS build | ||
ARG TARGETPLATFORM | ||
ARG BUILDPLATFORM | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log | ||
|
||
# Download binary | ||
RUN wget https://github.com/quarylabs/quary/releases/download/0.0.102/quary-0.0.102-quary-linux-aarch64-gnu.zip | ||
|
||
# Install unzip | ||
RUN apk add --no-cache unzip | ||
# Unzip binary | ||
RUN unzip /app/quary-0.0.102-quary-linux-aarch64-gnu.zip | ||
|
||
RUN ls -la | ||
|
||
FROM --platform=$BUILDPLATFORM alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=build /app/quary /app/quary | ||
|
||
# Set the binary as the entrypoint | ||
ENTRYPOINT ["quary"] |
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,66 @@ | ||
|
||
# This script materializes all models in a Quary project to TABLE | ||
# Usage: python .hacking/project_scripts/materialize_all_to_tables.py <target_directory i.e. ../models> | ||
|
||
import os | ||
import yaml | ||
def find_closest_schema_file(dir_path, base_path): | ||
"""Search for the closest schema file in the parent directories.""" | ||
current_path = dir_path | ||
while current_path != base_path: | ||
for file in os.listdir(current_path): | ||
if file.endswith("_models.yaml") or file == "schema.yaml": | ||
return os.path.join(current_path, file) | ||
parent_path = os.path.dirname(current_path) | ||
if parent_path == current_path: # Reached the root directory | ||
break | ||
current_path = parent_path | ||
return None | ||
|
||
def create_or_update_schema_file(base_path, dir_path, model_name): | ||
schema_file = find_closest_schema_file(dir_path, base_path) | ||
if not schema_file: | ||
schema_file = os.path.join(dir_path, "schema.yaml") | ||
with open(schema_file, 'w') as f: | ||
yaml.dump({'models': []}, f) | ||
|
||
with open(schema_file, 'r') as f: | ||
data = yaml.safe_load(f) or {'models': []} | ||
|
||
model_found = False | ||
for model in data['models']: | ||
if model['name'] == model_name: | ||
model['materialization'] = 'table' | ||
model_found = True | ||
break | ||
if not model_found: | ||
data['models'].append({'name': model_name, 'materialization': 'table'}) | ||
|
||
with open(schema_file, 'w') as f: | ||
yaml.safe_dump(data, f, sort_keys=False) | ||
|
||
def process_directory(base_path, dir_path): | ||
if "sources" in dir_path: | ||
return | ||
|
||
sql_files = [f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, f)) and f.endswith('.sql')] | ||
for sql_file in sql_files: | ||
model_name = os.path.splitext(sql_file)[0] | ||
create_or_update_schema_file(base_path, dir_path, model_name) | ||
|
||
for item in os.listdir(dir_path): | ||
full_path = os.path.join(dir_path, item) | ||
if os.path.isdir(full_path) and not item == "sources": | ||
process_directory(base_path, full_path) | ||
|
||
def main(target_dir): | ||
base_path = os.path.abspath(target_dir) | ||
process_directory(base_path, base_path) | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
if len(sys.argv) != 2: | ||
print("Usage: python script.py <target_directory>") | ||
sys.exit(1) | ||
|
||
main(sys.argv[1]) |
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,8 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
for f in ./.hacking/scripts/*.sh | ||
do | ||
shellcheck "$f" | ||
done |
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,40 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
# Check if a version number is provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "Please provide a version number as an argument." | ||
exit 1 | ||
fi | ||
|
||
# Set variables | ||
version="$1" | ||
project_name="quary" | ||
timestamp=$(date +%Y%m%d-%H%M%S) | ||
build_dir="build/$project_name-$timestamp" | ||
|
||
# Create the build directory | ||
mkdir -p "$build_dir" | ||
|
||
# Iterate over the architectures and operating systems | ||
archs=("amd64" "arm64") | ||
oses=("linux" "darwin") | ||
|
||
for arch in "${archs[@]}"; do | ||
for os in "${oses[@]}"; do | ||
# Set the output binary name | ||
output_binary="$build_dir/${project_name}_${os}_${arch}_${version}" | ||
|
||
# Build the Go binary for the specific architecture and operating system | ||
echo "Building $project_name for $os/$arch..." | ||
env CGO=0 GOOS="$os" GOARCH="$arch" go build -o "$output_binary" ./main.go | ||
|
||
echo "Build successful: $output_binary" | ||
|
||
# Compress the binary using gzip | ||
echo "Compressing binary..." | ||
gzip "$output_binary" | ||
echo "Compression successful: ${output_binary}.gz" | ||
done | ||
done |
Oops, something went wrong.