name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
name: Test (Rust)
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:15
ports:
- 5433:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgrest_parser_test
options: >-
--health-cmd "pg_isready -U postgres -d postgrest_parser_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 with:
toolchain: stable
components: clippy, rustfmt
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 - run: PGPASSWORD=postgres psql -h localhost -p 5433 -U postgres -d postgrest_parser_test -f tests/fixtures/init.sql
- run: cargo fmt --check
- run: cargo clippy --all-targets -- -D warnings
- run: cargo test
- run: cargo test --features full
test-wasm:
name: Test (WASM)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 with:
toolchain: stable
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 - run: cargo install wasm-pack
- run: wasm-pack build --target web --out-dir pkg -- --features wasm
test-e2e:
name: Test (E2E Package)
needs: test-wasm
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 with:
toolchain: stable
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with:
node-version: 20
- run: cargo install wasm-pack
- run: npm run build
- run: cd pkg && npm pack --pack-destination ../e2e
- run: cd e2e && npm install ./postgrest-parser-*.tgz && node test.mjs