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
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
groups:
cargo:
patterns: ["*"]

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
actions:
patterns: ["*"]
# release.yml is generated by `dist generate`; its actions are pinned in
# dist-workspace.toml ([dist.github-action-commits]) and updated there.
ignore:
- dependency-name: actions/checkout
- dependency-name: actions/upload-artifact
- dependency-name: actions/download-artifact
- dependency-name: actions/setup-node
- dependency-name: actions/attest
22 changes: 22 additions & 0 deletions .github/workflows/api-contract.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: API contract

on:
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:
pull_request:
paths:
- src/model.rs
- src/commands.rs
- scripts/check-api-contract.py
- .github/workflows/api-contract.yml

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- run: python3 scripts/check-api-contract.py
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on:
push:
branches: [master]
pull_request:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- run: cargo fmt --check
- run: cargo clippy --all-targets --locked -- -D warnings

test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- run: cargo test --locked

msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: "1.88"
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
- run: cargo check --locked

audit:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Maintenance

on:
schedule:
- cron: "41 7 * * 1"
workflow_dispatch:

permissions:
contents: read

jobs:
credentials:
runs-on: ubuntu-latest
steps:
- name: Check release credentials
env:
TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
headers=$(curl -sS -o /dev/null -D - -w '%{http_code}' \
-H "Authorization: Bearer $TOKEN" \
https://api.github.com/repos/BlockIo/homebrew-tap)
status=$(printf '%s' "$headers" | tail -n 1)
if [ "$status" != "200" ]; then
echo "::error::HOMEBREW_TAP_TOKEN was rejected (HTTP $status); replace it"
exit 1
fi
expires=$(printf '%s' "$headers" | tr -d '\r' \
| sed -n 's/^github-authentication-token-expiration: //Ip')
[ -z "$expires" ] && exit 0
days=$(( ($(date -d "$expires" +%s) - $(date +%s)) / 86400 ))
if [ "$days" -lt 30 ]; then
echo "::error::HOMEBREW_TAP_TOKEN expires in $days days; replace it"
exit 1
fi
62 changes: 62 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Publishes the npm package. Called by release.yml, or run by hand for a tag.
name: Publish npm

on:
workflow_call:
inputs:
plan:
required: true
type: string
workflow_dispatch:
inputs:
tag:
description: Release tag to publish, e.g. v0.1.1
required: true
type: string

permissions: {}

jobs:
publish:
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
steps:
- name: Fetch the npm package from this run
if: ${{ inputs.plan != '' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
pattern: artifacts-*
path: npm/
merge-multiple: true

- name: Fetch the npm package from the GitHub release
if: ${{ inputs.plan == '' }}
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \
--pattern '*-npm-package.tar.gz' --dir npm/

- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"

- name: Update npm
run: npm install --global npm@latest

- name: Publish
run: |
npm --version
shopt -s nullglob
packages=(npm/*-npm-package.tar.gz)
if [ ${#packages[@]} -eq 0 ]; then
echo "no npm package found" >&2
exit 1
fi
for pkg in "${packages[@]}"; do
npm stage publish --access public "./$pkg"
done
Loading
Loading