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 b3bc22a commit 62db692
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Dry Run

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

env:
CARGO_TERM_COLOR: always

jobs:
release-dry-run:
name: Dry-run cargo publish
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release') }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- 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
10 changes: 10 additions & 0 deletions scripts/dry-run-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

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

for PKG in ${PACKAGES}; do
if ! echo ${EXCLUDE} | grep -q -P "( |^)${PKG}( |$)"; then
cargo publish -p ${PKG} --dry-run --verbose "$@" || exit $?
fi
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 62db692

Please sign in to comment.