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
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
pull_request:
push:
branches:
- main

# Cancel superseded runs on the same ref (a new push/PR sync) to save runners.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
# Incremental compilation bloats the cache and buys nothing in CI's cold builds.
CARGO_INCREMENTAL: "0"

jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Installs the toolchain + components pinned in rust-toolchain.toml.
- name: Install Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci-clippy
# Restore on every run, but only write the cache from main so PRs can't
# pollute it and we stay within the repo's 10 GB cache budget.
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy --all-features --all-targets -- -D warnings

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci-test
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo test --all-features --locked

check:
name: Check (windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci-check-windows
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo check --all-features --locked
34 changes: 34 additions & 0 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish (crates.io)

# Reusable workflow invoked by the cargo-dist release pipeline as a custom
# `publish-jobs` entry. dist calls it with the release plan and `secrets: inherit`
# only on real tag releases, after the `host` job has created the GitHub release.
on:
workflow_call:
inputs:
plan:
description: "The release plan emitted by cargo-dist"
required: true
type: string

jobs:
crates-io:
name: cargo publish
runs-on: ubuntu-latest
timeout-minutes: 25
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Pinned via rust-toolchain.toml.
- name: Install Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: cargo publish
run: cargo publish --all-features --locked
42 changes: 0 additions & 42 deletions .github/workflows/publish.yml

This file was deleted.

17 changes: 16 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,30 @@ jobs:
done
git push

custom-publish-crates:
needs:
- plan
- host
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
uses: ./.github/workflows/publish-crates.yml
with:
plan: ${{ needs.plan.outputs.val }}
secrets: inherit
# publish jobs get escalated permissions
permissions:
"id-token": "write"
"packages": "write"

announce:
needs:
- plan
- host
- publish-homebrew-formula
- custom-publish-crates
# use "always() && ..." to allow us to wait for all publish jobs while
# still allowing individual publish jobs to skip themselves (for prereleases).
# "host" however must run to completion, no skipping allowed!
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }}
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.custom-publish-crates.result == 'skipped' || needs.custom-publish-crates.result == 'success') }}
runs-on: "ubuntu-22.04"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
92 changes: 0 additions & 92 deletions .github/workflows/validate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ install-updater = true
# A GitHub repo to push Homebrew formulas to
tap = "txpipe/homebrew-tap"
# Publish jobs to run in CI
publish-jobs = ["homebrew"]
publish-jobs = ["homebrew", "./publish-crates"]
# A namespace to use when publishing this package to the npm registry
npm-scope = "@txpipe"

Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.89"
components = ["rustfmt", "clippy"]
Loading