-
Notifications
You must be signed in to change notification settings - Fork 5
145 lines (134 loc) · 4.52 KB
/
pr-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
name: "Pull Request CI"
on:
push:
branches:
- main
- release-*
- refs/tags/*
pull_request:
branches:
- "*" # Quotes required because * is reserved by YAML
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-test:
name: "Build and Test"
runs-on: ubuntu-latest
steps:
- name: Checkout tiledb-rs
uses: actions/checkout@v4
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: Setup Rustc Cache
uses: Swatinem/rust-cache@v2
- name: Install TileDB
uses: ./.github/actions/install-tiledb
- name: Build
run: cargo build --all-targets --all-features
- name: Test
run: |
cargo test --all-targets --all-features
status=$?
echo "Process exited with status ${status}"
lint:
name: "Lint - Stable"
strategy:
matrix:
os:
- "ubuntu-latest"
- "linux-arm64-ubuntu24"
- "macos-13"
- "macos-latest"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tiledb-rs
uses: actions/checkout@v4
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Setup Rustc Cache
uses: Swatinem/rust-cache@v2
- name: Install TileDB
uses: ./.github/actions/install-tiledb
- name: Check Formatting
run: cargo fmt --quiet --check
- name: Lint
run: cargo clippy --no-deps --all-targets --all-features -- -Dwarnings
lint-nightly:
name: "Lint - Nightly"
continue-on-error: true
strategy:
matrix:
os:
- "ubuntu-latest"
- "linux-arm64-ubuntu24"
- "macos-13"
- "macos-latest"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout tiledb-rs
uses: actions/checkout@v4
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- name: Setup Rustc Cache
uses: Swatinem/rust-cache@v2
- name: Install TileDB
uses: ./.github/actions/install-tiledb
- name: Check Formatting
run: cargo fmt --quiet --check
- name: Lint
run: cargo clippy --no-deps --all-targets --all-features -- -Dwarnings
check-pr-title:
name: "Check Title Format"
if: ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout tiledb-rs
uses: actions/checkout@v4
- name: "Check Title Format"
shell: python
env:
PR_TITLE: ${{ github.event.pull_request.title }}
GIT_SHA: ${{ github.sha }}
run: |
import os
import re
import subprocess as sp
PAT = re.compile(r"^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)")
# We're checking both the PR title and the subject of the last commit
# to the PR. The reason for also checking the commit is that when a
# PR has a single commit, its the commit subject that is used by
# default which means it'll break our changelog generation scripts.
if not PAT.match(os.environ["PR_TITLE"]):
print("The pull request title does not match Conventional Commits syntax")
print("See: https://www.conventionalcommits.org/en/v1.0.0/")
exit(1)
# Read the subject of the last commit in the branch.
subject = sp.check_output(["git", "log", "--format=%B", "-n", "1", os.environ["GIT_SHA"]])
subject = subject.strip()
if not PAT.match(subject):
print("The last commit on this PR branch does not match Conventional Commits syntax")
print("See: https://www.conventionalcommits.org/en/v1.0.0/")
exit(1)
check-api-coverage:
name: "Check API Coverage"
runs-on: ubuntu-latest
steps:
- name: Checkout tiledb-rs
uses: actions/checkout@v4
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- name: Setup Rustc Cache
uses: Swatinem/rust-cache@v2
- name: Install Cargo Expand
run: cargo install cargo-expand
- name: Install TileDB
uses: ./.github/actions/install-tiledb
- name: Build API Coverage Tool
run: cd tools/api-coverage && cargo build
- name: Calculate Coverage
run: ./target/debug/api-coverage 2>&1 >> $GITHUB_STEP_SUMMARY