chore(ci): Updating title checks and avoiding requests #605
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |