-
Notifications
You must be signed in to change notification settings - Fork 14
106 lines (89 loc) · 3 KB
/
main.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
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
- "[0-9].x"
name: Continuous integration
jobs:
ci:
env:
RUSTFLAGS: ${{ matrix.rust == 'nightly' && matrix.os == 'ubuntu-latest' && '-Z sanitizer=leak' || '' }}
strategy:
fail-fast: false
matrix:
rust:
- stable
- nightly
os:
- ubuntu-latest
- windows-latest
include:
- rust: stable-x86_64-pc-windows-gnu
os: windows-latest
- rust: stable-i686-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install rustup if needed
run: |
if ! command -v rustup &>/dev/null; then
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
fi
if: runner.os != 'Windows'
shell: bash
- name: Install toolchain
run: rustup toolchain install ${{ matrix.rust }} --profile minimal --no-self-update
shell: bash
- name: Default to nightly if requested
run: rustup default nightly
if: matrix.rust == 'nightly'
- name: Build pg_query
run: cargo build
- name: Run tests
run: cargo test
check_style:
name: Check file formatting and style
runs-on: ubuntu-latest
steps:
- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rustup if needed
run: |
if ! command -v rustup &>/dev/null; then
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
fi
if: runner.os != 'Windows'
shell: bash
- name: Install toolchain
run: rustup toolchain install stable --component clippy --component rustfmt --profile minimal --no-self-update
shell: bash
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: clippy-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Check file formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy