PRQL / prql

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
https://prql-lang.org
Apache License 2.0
9.65k stars 208 forks source link

feat: add build information to build comment #4546

Open m-span opened 1 month ago

m-span commented 1 month ago

Adds feat. requested in #3393

example output:

SELECT
  b
FROM
  a

-- Generated by PRQL compiler version:0.11.3-230-ga6218a6f (https://prql-lang.org)

On my M1 pro, it appears to add ~0.5s to the re-build process, bringing the total to somewhere between 3.6 and 5.7 seconds

m-span commented 1 month ago

hmm CI tests are failing in an interesting way:

thread 'main' panicked at prqlc/prqlc/src/lib.rs:124:26:
Invalid prqlc version number: c91cacc: Error("unexpected character 'c' while parsing major version number")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I don't know how git describe --tags is only outputting c91cacc, especially since that hash commit doesn't seem to exist.

Maybe there's something about how the CI is run that I don't understand? Is git available via command line within the CI?

max-sixty commented 1 month ago

Nice!

Interesting re the git issue. I agree the commit doesn't seem to exist. But OTOH it does state here that that does seem to be the commit... https://github.com/PRQL/prql/actions/runs/9395042476/job/25873760775?pr=4546#step:2:56

I think it's probably creating a merge commit to simulate this branch being merged into main. And it's possibly doing a shallow clone so the tags aren't there.

Do you know if we can change the clone to be less shallow?

Either way we should make this robust to not having tags there — e.g. fall back to an empty string, I think.

max-sixty commented 1 month ago

Yes seems like we need something like: https://github.com/actions/checkout/issues/217#issuecomment-900923602

max-sixty commented 1 month ago

No obligation to use vergen, but:

cargo run -p prqlc -- --version
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/prqlc --version`
prqlc 0.11.5
eitsupi commented 1 month ago

I'm not sure how this works with downstream packages. What happens if I install from crates.io?

max-sixty commented 1 month ago

I'm not sure how this works with downstream packages. What happens if I install from crates.io?

It would need to fall back to just the version number