Allow an optional unit when specifying bytes in SQL #128
This file contains hidden or 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
| # Copyright 2022 The ModelarDB Contributors | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: Build, Lint, Test, and Upload | |
| on: | |
| pull_request: | |
| branches: main | |
| push: | |
| branches: main | |
| env: | |
| # General. | |
| CARGO_TERM_COLOR: always | |
| RUSTFLAGS: -C strip=symbols -D warnings | |
| RUSTDOCFLAGS: -D warnings | |
| LLVM_PROFILE_FILE: modelardb-%p-%m.profraw | |
| # MinIO. | |
| AWS_ACCESS_KEY_ID: minioadmin | |
| AWS_SECRET_ACCESS_KEY: minioadmin | |
| AWS_DEFAULT_REGION: eu-central-1 | |
| AWS_ENDPOINT: http://127.0.0.1:9000 | |
| AWS_ALLOW_HTTP: true | |
| jobs: | |
| build_lint_and_test: | |
| name: Build, Lint, and Test | |
| env: | |
| RUSTFLAGS: -C instrument-coverage -C strip=symbols -D warnings | |
| runs-on: ${{ matrix.operating-system }} | |
| strategy: | |
| matrix: | |
| operating-system: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| # Retrieve Code. | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Setup MinIO. | |
| - name: Setup MinIO | |
| shell: bash | |
| run: | | |
| case $(uname) in | |
| 'Linux') | |
| curl -L -O https://github.com/pgsty/minio/releases/download/RELEASE.2026-06-18T00-00-00Z/minio_20260618000000.0.0_linux_amd64.tar.gz ;; | |
| 'Darwin') | |
| curl -L -O https://github.com/pgsty/minio/releases/download/RELEASE.2026-06-18T00-00-00Z/minio_20260618000000.0.0_darwin_arm64.tar.gz ;; | |
| *) | |
| curl -L -O https://github.com/pgsty/minio/releases/download/RELEASE.2026-06-18T00-00-00Z/minio_20260618000000.0.0_windows_amd64.tar.gz ;; | |
| esac | |
| tar -xf minio_*.tar.gz | |
| ./minio server minio_data_folder --console-address :9001 & | |
| sleep 5 # Ensure minio has fully finished creating the endpoint. | |
| aws s3 mb s3://modelardb --endpoint-url http://localhost:9000 | |
| # Setup Azurite. | |
| - name: Setup Azurite | |
| shell: bash | |
| run: | | |
| npm install azurite | |
| node_modules/.bin/azurite --skipApiVersionCheck --location azurite_data_folder & | |
| sleep 5 # Ensure azurite has fully finished creating the endpoint. | |
| az storage container create -n modelardb --connection-string 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;' | |
| # Update Rust. | |
| - name: Rustup Update | |
| run: rustup update | |
| - name: Rustup Add llvm-tools | |
| run: rustup component add llvm-tools-preview | |
| - name: Cargo Install grcov | |
| run: cargo install grcov | |
| - name: Cargo Install machete | |
| run: cargo install cargo-machete | |
| # Cache Cargo Dependencies. | |
| - name: Cache Dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| # Run Rust Lints and Tests. | |
| - name: Cargo Build | |
| run: cargo build --verbose --all-targets | |
| - name: Cargo Clippy | |
| run: cargo clippy --verbose --all-targets | |
| - name: Cargo Doc | |
| run: cargo doc --verbose --no-deps | |
| - name: Cargo Machete | |
| run: cargo machete --with-metadata | |
| - name: Cargo Test | |
| run: cargo test --verbose --all-targets -- --nocapture | |
| # Run Python Tests. | |
| - name: Python Version | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Pip Sphinx | |
| run: python -m pip install sphinx --break-system-packages --user | |
| - name: Pip Install | |
| run: python -m pip install . --break-system-packages --user | |
| working-directory: crates/modelardb_embedded/bindings/python | |
| - name: Python Doc | |
| run: python -m sphinx.cmd.build -M html . _build -W | |
| working-directory: crates/modelardb_embedded/bindings/python/docs | |
| - name: Python Unittest | |
| run: python -m unittest --verbose | |
| working-directory: crates/modelardb_embedded/bindings/python | |
| # Upload Code Coverage Report. | |
| - name: Grcov Upload | |
| run: grcov . --source-dir . --binary-path ./target/debug/ --output-types html --branch --ignore-not-existing -o ./target/debug/coverage/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: Code Coverage ${{ matrix.operating-system }} | |
| path: ./target/debug/coverage/ | |
| build_and_upload_binaries: | |
| name: Build and Upload Binaries | |
| needs: build_lint_and_test | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ${{ matrix.operating-system }} | |
| strategy: | |
| matrix: | |
| operating-system: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| # Retrieve Code. | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Update Rust. | |
| - name: Rustup Update | |
| run: rustup update | |
| # Build Rust Binaries. | |
| - name: Cargo Build Binaries | |
| run: cargo build --release --jobs 1 --verbose # --jobs 1 reduce resource use. | |
| # Build Python Binaries. | |
| - name: Python Version | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Pip Dependencies | |
| run: python -m pip install build setuptools --break-system-packages --user | |
| - name: Python Build | |
| run: python -m build --verbose | |
| working-directory: crates/modelardb_embedded/bindings/python | |
| # Collect and Rename Binaries. | |
| - name: Rust Triple | |
| shell: bash | |
| run: | # | is needed as nested mappings are not allowed in compact mappings. | |
| echo RUST_TRIPLE=$(rustc -Vv | grep 'host: ' | cut -d' ' -f2) >> $GITHUB_ENV | |
| - name: Create Release Folder | |
| shell: bash | |
| run: | | |
| mkdir modelardb_$RUST_TRIPLE | |
| mv crates/modelardb_embedded/bindings/python/dist/*.whl modelardb_$RUST_TRIPLE/ | |
| mv crates/modelardb_embedded/bindings/python/dist/*.tar.gz modelardb_$RUST_TRIPLE/ | |
| if [[ $RUNNER_OS == 'Windows' ]]; then SUFFIX='.exe'; else SUFFIX=''; fi | |
| mv target/release/modelardb$SUFFIX modelardb_$RUST_TRIPLE/modelardb$SUFFIX | |
| mv target/release/modelardbb$SUFFIX modelardb_$RUST_TRIPLE/modelardbb$SUFFIX | |
| mv target/release/modelardbd$SUFFIX modelardb_$RUST_TRIPLE/modelardbd$SUFFIX | |
| # Upload Binaries. | |
| - name: Artifact Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: modelardb_${{ github.sha }}_${{ env.RUST_TRIPLE }} | |
| path: modelardb_${{ env.RUST_TRIPLE }}/* |