Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions .github/workflows/hk.yml → .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
name: hk
name: Audit

on:
pull_request:
push:
branches:
- main
schedule:
- cron: "23 7 * * *"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.run_id }}
cancel-in-progress: false

permissions: {}

jobs:
check:
name: Check
audit-dependencies:
name: Audit dependencies
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -29,11 +25,7 @@ jobs:
persist-credentials: false
- name: Install tools
uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
- name: Check and generate the ToolConfig files
- name: Check and generate ToolConfig files
uses: mathematic-inc/toolconfig-action@1baf7b021e8bf6f0e20737753c13af0fc93c8570 # v2026.11.0
- name: Audit dependencies
if: github.event_name == 'schedule'
run: cargo-deny --locked --workspace check
- name: Run checks
if: github.event_name != 'schedule'
run: hk check --all --slow --skip-step toolconfig
75 changes: 60 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,40 @@ on:
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read
permissions: {}

jobs:
msrv:
name: Rust 1.94.0
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install tools
uses: jdx/mise-action@90f833d396d0cc3674b631d2d225e306476c303a # v5.2.10
- name: Check and generate ToolConfig files
uses: mathematic-inc/toolconfig-action@1baf7b021e8bf6f0e20737753c13af0fc93c8570 # v2026.11.0
- name: Run checks
run: hk check --all --slow --skip-step toolconfig

check-msrv:
name: Check MSRV
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

Expand All @@ -37,6 +56,7 @@ jobs:
run: rustup run 1.94.0 cargo test --locked -p sqlc-gen-sqlx --all-features --lib --test codegen

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
Expand All @@ -57,7 +77,8 @@ jobs:
--health-retries 5

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

Expand All @@ -66,34 +87,36 @@ jobs:
with:
sqlc-version: "1.31.1"

- name: Install Rust stable
- name: Install Rust
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
targets: wasm32-wasip1

- name: Snapshot tests
- name: Run snapshot tests
run: cargo test --workspace
env:
INSTA_UPDATE: unseen

- name: Build WASM plugin
run: cargo build --target wasm32-wasip1

- name: Integration tests
- name: Run integration tests
run: cargo test -p basic
env:
DATABASE_URL: postgres://sqlc:sqlc@localhost:5432/sqlc_test

- name: Verify package
run: cargo package --locked

proto-check:
check-protos:
name: Check protos
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

Expand All @@ -102,7 +125,7 @@ jobs:
with:
install_args: toolconfig

- name: Check and generate the ToolConfig files
- name: Check and generate ToolConfig files
uses: mathematic-inc/toolconfig-action@1baf7b021e8bf6f0e20737753c13af0fc93c8570 # v2026.11.0

- name: Install buf
Expand All @@ -120,7 +143,29 @@ jobs:
git diff --exit-code -- src

prebuilt:
name: Verify prebuilt distribution
permissions:
contents: read
name: Verify prebuilt distribution
uses: $/.github/workflows/prebuilt.yml

required:
name: required
if: always()
needs:
- check
- check-msrv
- test
- check-protos
- prebuilt
runs-on: ubuntu-latest
timeout-minutes: 5
permissions: {}
steps:
- name: Check every other job passed
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<< "$NEEDS"
echo "::error::A job failed or was cancelled."
exit 1
15 changes: 7 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ on:
- cron: "0 6 * * 1"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions: {}

jobs:
analyze:
name: Analyze (${{ matrix.language }})
Expand All @@ -28,18 +27,18 @@ jobs:
matrix:
language: [actions, rust]
steps:
- name: Checkout
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install Rust toolchain
- name: Install Rust
if: matrix.language == 'rust'
uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable

- name: Cache cargo artifacts
- name: Restore Cargo cache
if: matrix.language == 'rust'
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3

Expand All @@ -50,7 +49,7 @@ jobs:
languages: ${{ matrix.language }}
queries: security-extended

- name: Perform CodeQL Analysis
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
category: /language:${{ matrix.language }}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Dependabot strict gate
name: Dependabot gate

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions: {}

jobs:
strict-gate:
name: Strict Dependabot gate
dependabot-gate:
name: Dependabot gate
runs-on: ubuntu-24.04
timeout-minutes: 90
permissions:
Expand All @@ -27,7 +27,7 @@ jobs:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
steps:
- name: Require successful checks on the exact Dependabot head
- name: Require successful checks on exact Dependabot head
run: |
set -euo pipefail
if [[ "$GITHUB_EVENT_NAME" != pull_request || "$PR_AUTHOR" != 'dependabot[bot]' ]]; then
Expand All @@ -44,28 +44,26 @@ jobs:

checks=$(gh api "repos/$GITHUB_REPOSITORY/commits/$PR_HEAD_SHA/check-runs?per_page=100")
if jq -e '
.total_count <= 100 and
(.check_runs
| group_by([.name, .app.id])
| map(max_by([.started_at, .id]))) as $runs
| ([
["test", 15368],
["proto-check", 15368],
["Check", 15368],
.total_count as $total
| (.check_runs
| group_by([.name, .app.id])
| map(max_by([.started_at, .id]))) as $runs
| $total <= 100
and ([
["required", 15368],
["CodeQL", 57789],
["Rust 1.94.0", 15368],
["Analyze (actions)", 15368],
["Analyze (rust)", 15368]
] | all(.[]; . as $required |
($runs | map(select(.name == $required[0] and .app.id == $required[1]))) as $found
| ($found | length > 0 and all(.[]; .status == "completed" and .conclusion == "success"))
))
and ($runs | all(.[];
.name == "Strict Dependabot gate" or
((.name | startswith("Verify prebuilt distribution / Install without compiling")) and
.status == "completed" and .conclusion == "skipped") or
(.status == "completed" and .conclusion == "success")
))
and ($runs | all(.[];
.name == "Dependabot gate" or
((.name | startswith("Verify prebuilt distribution / Install without compiling")) and
.status == "completed" and .conclusion == "skipped") or
(.status == "completed" and .conclusion == "success")
))
' <<< "$checks" > /dev/null; then
echo "All exact-head checks passed on $PR_HEAD_SHA."
exit 0
Expand Down
Loading
Loading