Use sqlglot[rs] #14
Workflow file for this run
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| rust-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Lib unit tests | |
| run: cargo test --lib -p polyglot-sql | |
| - name: Generic identity tests | |
| run: cargo test --test sqlglot_identity test_sqlglot_identity_all -p polyglot-sql -- --nocapture | |
| - name: Dialect identity tests | |
| run: cargo test --test sqlglot_dialect_identity test_sqlglot_dialect_identity_all -p polyglot-sql -- --nocapture | |
| - name: Transpilation tests | |
| run: cargo test --test sqlglot_transpilation test_sqlglot_transpilation_all -p polyglot-sql -- --nocapture | |
| sdk-build: | |
| needs: rust-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Build WASM | |
| run: cd crates/polyglot-sql-wasm && wasm-pack build --target bundler --release --out-dir ../../packages/sdk/wasm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build SDK | |
| run: cd packages/sdk && pnpm run build | |
| - name: Test SDK | |
| run: cd packages/sdk && pnpm test | |
| - name: Upload WASM artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm | |
| path: packages/sdk/wasm/ | |
| - name: Upload SDK dist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: packages/sdk/dist/ | |
| publish-crate: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: sdk-build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Publish to crates.io | |
| run: cargo publish -p polyglot-sql | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| publish-npm: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: sdk-build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - name: Download WASM artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm | |
| path: packages/sdk/wasm/ | |
| - name: Download SDK dist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: packages/sdk/dist/ | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Publish to npm | |
| run: cd packages/sdk && pnpm publish --access public --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| deploy-docs: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [publish-crate, publish-npm] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Download WASM artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm | |
| path: packages/sdk/wasm/ | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build documentation | |
| run: cd packages/documentation && pnpm run build | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| workingDirectory: packages/documentation | |
| command: pages deploy dist --project-name=polyglot-sql-api | |
| deploy-playground: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [publish-crate, publish-npm] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Download WASM artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasm | |
| path: packages/sdk/wasm/ | |
| - name: Download SDK dist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: packages/sdk/dist/ | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build Playground | |
| run: cd packages/playground && pnpm run build | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| workingDirectory: packages/playground | |
| command: pages deploy dist --project-name=polyglot-sql-playground |