Open nyurik opened 6 months ago
This idea has come up before. Your example .yml file isn't quite enough.
It really needs to figure out the pgrx version used in Cargo.toml
and cargo install cargo-pgrx --version $THAT_VERSION --locked
. Ideally it would also configure a matrix for all the supported postgres versions, use apt
to install that version of postgres and cargo pgrx init --pgXX=/path/to/$PGVER/bin/pg_config
.
It might be useful to have macos included in the build matrix too. macos is a bit more difficult to configure, but it's doable.
@eeeebbbbrrrr I agree it doesn't do everything - but we should start somewhere, right? :) Let's start from some documentation, e.g. something like my YAML above can be added to the README.md file - maybe under <detail>
tag to make it collapsed by default - and we can slowly grow it to include different platforms and recommended packaging method.
In any case - having nothing is much worse than having a working example that only covers some of the usecases - so... let's do iterative approach?
P.S. I have used this approach for MSRV reuse before -- perhaps we can adapt it for PRGX version copying too? This code uses regex to get rust-version
from Cargo.toml, and uses it in another workflow step:
- name: Read crate metadata
id: metadata
run: echo "rust-version=$(sed -ne 's/rust-version *= *\"\(.*\)\"/\1/p' Cargo.toml)" >> $GITHUB_OUTPUT
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.metadata.outputs.rust-version }}
components: clippy,rustfmt
I think there should be a simple CI generated as part of the
prgx new
. Since most people tend to use github anyway, might as well give a github CI example - and it can be easily adjusted for other CI platforms if needed.P.S. I think an example of packaging (on the release page) would also be very helpful, as it would save a lot of time for developers on figuring out how to package for different platforms.