Skip to content

chore(ci): Updating title checks and avoiding requests #608

chore(ci): Updating title checks and avoiding requests

chore(ci): Updating title checks and avoiding requests #608

Workflow file for this run

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
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 2
- name: Debug checkout
shell: bash
run: |
git log --oneline -n10
- 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("Found title: '{}'".format(os.environ["PR_TITLE"]))
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().decode("utf-8")
if not PAT.match(subject):
print("The last commit on this PR branch does not match Conventional Commits syntax")
print("Found message: '{}'".format(subject))
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