-
Notifications
You must be signed in to change notification settings - Fork 350
153 lines (149 loc) · 5.38 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- trigger-ci-workflow
paths:
- "quickwit/**"
- "!quickwit/quickwit-ui/**"
env:
CARGO_INCREMENTAL: 0
QW_DISABLE_TELEMETRY: 1
QW_TEST_DATABASE_URL: postgres://quickwit-dev:quickwit-dev@localhost:5432/quickwit-metastore-dev
RUST_BACKTRACE: 1
RUSTDOCFLAGS: -Dwarnings -Arustdoc::private_intra_doc_links
RUSTFLAGS: -Dwarnings --cfg tokio_unstable
# Ensures that we cancel running jobs for the same PR / same workflow.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Unit tests
runs-on: "ubuntu-latest"
timeout-minutes: 40
services:
# PostgreSQL service container
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: quickwit-dev
POSTGRES_PASSWORD: quickwit-dev
POSTGRES_DB: quickwit-metastore-dev
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install Ubuntu packages
run: sudo apt-get -y install protobuf-compiler python3 python3-pip
- uses: dorny/paths-filter@v3
id: modified
with:
filters: |
rust_src:
- quickwit/**/*.rs
- quickwit/**/*.toml
- quickwit/**/*.proto
- quickwit/rest-api-tests/**
- .github/workflows/ci.yml
# The following step is just meant to install rustup actually.
# The next one installs the correct toolchain.
- name: Install rustup
if: steps.modified.outputs.rust_src == 'true'
run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
- name: Setup stable Rust Toolchain
if: steps.modified.outputs.rust_src == 'true'
run: rustup show
working-directory: ./quickwit
- name: Setup cache
uses: Swatinem/rust-cache@v2
if: steps.modified.outputs.rust_src == 'true'
with:
workspaces: "./quickwit -> target"
- name: Install nextest
if: always() && steps.modified.outputs.rust_src == 'true'
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-nextest
- name: cargo nextest
if: always() && steps.modified.outputs.rust_src == 'true'
run: cargo nextest run --features=postgres --retries 1
working-directory: ./quickwit
- name: cargo build
if: always() && steps.modified.outputs.rust_src == 'true'
run: cargo build --features=postgres --bin quickwit
working-directory: ./quickwit
- name: Install python packages
run: sudo pip3 install pyaml requests
if: always() && steps.modified.outputs.rust_src == 'true'
- name: run REST API tests
if: always() && steps.modified.outputs.rust_src == 'true'
run: python3 ./run_tests.py --binary ../target/debug/quickwit
working-directory: ./quickwit/rest-api-tests
lints:
name: Lints
runs-on: "ubuntu-latest"
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: modified
with:
filters: |
rust_src:
- quickwit/**/*.rs
- quickwit/**/*.toml
- quickwit/**/*.proto
- .github/workflows/ci.yml
- name: Install Ubuntu packages
if: always() && steps.modified.outputs.rust_src == 'true'
run: sudo apt-get -y install protobuf-compiler python3 python3-pip
- name: Install rustup
if: steps.modified.outputs.rust_src == 'true'
run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
- name: Setup nightly Rust Toolchain (for rustfmt)
if: steps.modified.outputs.rust_src == 'true'
run: rustup toolchain install nightly
- name: Setup stable Rust Toolchain
if: steps.modified.outputs.rust_src == 'true'
run: rustup show
working-directory: ./quickwit
- name: Setup cache
if: steps.modified.outputs.rust_src == 'true'
uses: Swatinem/rust-cache@v2
with:
workspaces: "./quickwit -> target"
- name: Install cargo deny
if: always() && steps.modified.outputs.rust_src == 'true'
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-deny
- name: cargo clippy
if: always() && steps.modified.outputs.rust_src == 'true'
run: cargo clippy --workspace --tests --all-features
working-directory: ./quickwit
- name: cargo deny
if: always() && steps.modified.outputs.rust_src == 'true'
run: cargo deny check licenses
working-directory: ./quickwit
- name: cargo doc
if: always() && steps.modified.outputs.rust_src == 'true'
run: cargo doc
working-directory: ./quickwit
- name: License headers check
if: always()
run: bash scripts/check_license_headers.sh
working-directory: ./quickwit
- name: rustfmt
if: always() && steps.modified.outputs.rust_src == 'true'
run: cargo +nightly fmt --all -- --check
working-directory: ./quickwit