Skip to content

Commit

Permalink
chore(ci): dry-run cargo publish on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Dec 18, 2024
1 parent a135627 commit ce21643
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Dry Run

on:
pull_request:
branches: [ "main", "next-major" ]

env:
CARGO_TERM_COLOR: always

jobs:
release-dry-run:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-version }}
- name: Install jq
uses: dcarbone/install-jq-action@v3
with:
version: "1.7"
- name: Dry run publish crates
run: scripts/dry-run-publish.sh
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Rust library for tools and encodings related to SAT solving library";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
systems.url = "github:nix-systems/default-linux";
};

Expand Down
7 changes: 7 additions & 0 deletions scripts/dry-run-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

PACKAGES=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[].name')

for PKG in ${PACKAGES}; do
cargo publish -p ${PKG} --dry-run --verbose || exit $1
done
2 changes: 2 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ in
rustup
cargo-rdme
cargo-nextest
release-plz
jq
];
buildInputs = libs;
RUSTC_VERSION = overrides.toolchain.channel;
Expand Down

0 comments on commit ce21643

Please sign in to comment.