Skip to content

Commit ef1cbfc

Browse files
merged
2 parents 9a28bee + 603a3c9 commit ef1cbfc

File tree

38 files changed

+484
-189
lines changed

38 files changed

+484
-189
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Free Disk Space
2+
description: Free up disk space on the runner
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Free Disk Space (Ubuntu)
7+
if: runner.os == 'Linux'
8+
uses: jlumbroso/free-disk-space@main
9+
with:
10+
# We need to reclaim some space, but uninstalling everyting takes
11+
# too long. So we'll just remove some of the larger packages.
12+
# https://github.com/jlumbroso/free-disk-space/pull/26
13+
android: true
14+
dotnet: true
15+
haskell: true
16+
large-packages: false

.github/actions/setup-monorepo/action.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Pull Request
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths: # Only run when changes are made to rust code or root Cargo
7+
- "crates/**"
8+
- "lib/**"
9+
- "fuzz/**"
10+
- "xtask/**"
11+
- "Cargo.toml"
12+
- "Cargo.lock"
13+
- "rust-toolchain.toml"
14+
- "rustfmt.toml"
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
env:
21+
RUSTFLAGS: -A dead_code
22+
RUST_LOG: info
23+
RUST_BACKTRACE: 1
24+
RUSTUP_WINDOWS_PATH_ADD_BIN: 1
25+
26+
jobs:
27+
format:
28+
name: Format
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout PR branch
32+
uses: actions/checkout@v4
33+
- name: Free Disk Space
34+
uses: ./.github/actions/free-disk-space
35+
- name: Install toolchain
36+
uses: moonrepo/setup-rust@v1
37+
with:
38+
components: rustfmt
39+
bins: taplo-cli
40+
cache-base: main
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Run format
44+
run: |
45+
cargo fmt --all --check
46+
taplo format --check
47+
48+
actionlint:
49+
name: Lint GitHub Actions
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Download actionlint
54+
id: get_actionlint
55+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
56+
shell: bash
57+
- name: Check workflow files
58+
run: ${{ steps.get_actionlint.outputs.executable }} -color
59+
shell: bash
60+
61+
lint:
62+
name: Lint Project
63+
runs-on: ubuntu-latest
64+
services:
65+
postgres:
66+
image: postgres:latest
67+
env:
68+
POSTGRES_USER: postgres
69+
POSTGRES_PASSWORD: postgres
70+
POSTGRES_DB: postgres
71+
ports:
72+
- 5432:5432
73+
steps:
74+
- name: Checkout PR Branch
75+
uses: actions/checkout@v4
76+
with:
77+
submodules: true
78+
- name: Free Disk Space
79+
uses: ./.github/actions/free-disk-space
80+
- name: Install toolchain
81+
uses: moonrepo/setup-rust@v1
82+
with:
83+
components: clippy
84+
cache-base: main
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
- name: Run clippy
88+
run: |
89+
cargo clippy
90+
cargo run -p rules_check
91+
92+
# check-dependencies:
93+
# name: Check Dependencies
94+
# runs-on: ubuntu-latest
95+
# services:
96+
# postgres:
97+
# image: postgres:latest
98+
# env:
99+
# POSTGRES_USER: postgres
100+
# POSTGRES_PASSWORD: postgres
101+
# POSTGRES_DB: postgres
102+
# ports:
103+
# - 5432:5432
104+
# steps:
105+
# - name: Checkout PR Branch
106+
# uses: actions/checkout@v4
107+
# with:
108+
# submodules: true
109+
# - name: Free Disk Space
110+
# uses: ./.github/actions/free-disk-space
111+
# - name: Install toolchain
112+
# run: rustup toolchain install nightly
113+
# - name: Install udeps
114+
# run: cargo install cargo-udeps --locked
115+
# - name: Detect unused dependencies using udeps
116+
# run: cargo +nightly udeps --all-targets
117+
118+
test:
119+
name: Test
120+
runs-on: ${{ matrix.os }}
121+
strategy:
122+
matrix:
123+
include:
124+
# reactive once we upgrade to the latest version of pg_query that is windows-compatible
125+
# - os: windows-latest
126+
- os: ubuntu-latest
127+
steps:
128+
- name: Checkout PR branch
129+
uses: actions/checkout@v4
130+
with:
131+
submodules: true
132+
- name: Free Disk Space
133+
uses: ./.github/actions/free-disk-space
134+
- name: Install toolchain
135+
uses: moonrepo/setup-rust@v1
136+
with:
137+
cache-base: main
138+
env:
139+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
140+
141+
# running containers via `services` only works on linux
142+
# https://github.com/actions/runner/issues/1866
143+
- name: Setup postgres
144+
uses: ikalnytskyi/action-setup-postgres@v7
145+
- name: Run tests
146+
run: cargo test --workspace
147+
148+
codegen:
149+
name: Check Codegen
150+
runs-on: ubuntu-latest
151+
services:
152+
postgres:
153+
image: postgres:latest
154+
env:
155+
POSTGRES_USER: postgres
156+
POSTGRES_PASSWORD: postgres
157+
POSTGRES_DB: postgres
158+
ports:
159+
- 5432:5432
160+
steps:
161+
- name: Checkout PR branch
162+
uses: actions/checkout@v4
163+
with:
164+
submodules: true
165+
- name: Free Disk Space
166+
uses: ./.github/actions/free-disk-space
167+
- name: Install toolchain
168+
uses: moonrepo/setup-rust@v1
169+
with:
170+
cache-base: main
171+
env:
172+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
- name: Run the analyser codegen
174+
run: cargo run -p xtask_codegen -- analyser
175+
- name: Run the configuration codegen
176+
run: cargo run -p xtask_codegen -- configuration
177+
- name: Check for git diff
178+
run: |
179+
if [[ $(git status --porcelain) ]]; then
180+
git status
181+
git diff
182+
exit 1
183+
fi

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/pg_completions/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ async-std = "1.12.0"
1616

1717
text-size.workspace = true
1818

19+
serde = { workspace = true, features = ["derive"] }
20+
serde_json = { workspace = true }
1921
pg_schema_cache.workspace = true
2022
tree-sitter.workspace = true
2123
tree_sitter_sql.workspace = true

crates/pg_completions/src/complete.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use serde::{Deserialize, Serialize};
12
use text_size::TextSize;
23

34
use crate::{
@@ -17,9 +18,9 @@ pub struct CompletionParams<'a> {
1718
pub tree: Option<&'a tree_sitter::Tree>,
1819
}
1920

20-
#[derive(Debug, Default)]
21+
#[derive(Debug, Default, Serialize, Deserialize)]
2122
pub struct CompletionResult {
22-
pub items: Vec<CompletionItem>,
23+
pub(crate) items: Vec<CompletionItem>,
2324
}
2425

2526
impl IntoIterator for CompletionResult {

0 commit comments

Comments
 (0)