PostgREST / postgrest

REST API for any Postgres database
https://postgrest.org
MIT License
23.28k stars 1.02k forks source link

Automate Hackage release #2275

Open steve-chavez opened 2 years ago

steve-chavez commented 2 years ago

Manual Hackage releases can lag considerably - I just released https://hackage.haskell.org/package/postgrest-9.0.0 :man_facepalming:

This should be automated on CI.

Steps I follow:

$ nix-shell

$ cabal v2-haddock --haddock-for-hackage --enable-doc
$ cabal sdist # might not be necessary

$ cabal upload dist-newstyle/sdist/postgrest-9.0.0.tar.gz
hackage.haskell.org username:
hackage.haskell.org password:
Uploading dist-newstyle/sdist/postgrest-9.0.0.tar.gz...
Error uploading dist-newstyle/sdist/postgrest-9.0.0.tar.gz: http code 400
Error: Invalid package

'ghc-options: -fhpc' is not necessary. Use the configure flag
--enable-coverage instead.

# I manually remove the fhpc from postgrest.cabal and run cabal sdist again

$ cabal upload dist-newstyle/sdist/postgrest-9.0.0.tar.gz
hackage.haskell.org username: 
hackage.haskell.org password:
Uploading dist-newstyle/sdist/postgrest-9.0.0.tar.gz...
Error uploading dist-newstyle/sdist/postgrest-9.0.0.tar.gz: http code 400
Error: Invalid package

'ghc-options: -Wall -Werror' makes the package very easy to break with future
GHC versions because new GHC versions often add new warnings. Use just
'ghc-options: -Wall' instead. Alternatively, if you want to use this, make it
conditional based on a Cabal configuration flag (with 'manual: True' and
'default: False') and enable that flag during development.

# Same with above, rerun cabal sdist

$ cabal upload dist-newstyle/sdist/postgrest-9.0.0.tar.gz
hackage.haskell.org username: 
hackage.haskell.org password:
Uploading dist-newstyle/sdist/postgrest-9.0.0.tar.gz...
Package successfully uploaded as candidate. You can now preview the result at
'https://hackage.haskell.org/package/postgrest-9.0.0/candidate'. To publish
the candidate, use 'cabal upload --publish'.
Warnings:
- 'ghc-options: -O0' is not needed. Use the --disable-optimization configure
flag.
- 'ghc-options: -O0' is not needed. Use the --disable-optimization configure
flag.
- 'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit
and not just imposing longer compile times on your users.

# The above succeeded

# For docs
cabal upload -d dist-newstyle/postgrest-9.0.0-docs.tar.gz
hackage.haskell.org username: 
hackage.haskell.org password:
Uploading documentation dist-newstyle/postgrest-9.0.0-docs.tar.gz...
Documentation successfully uploaded for package candidate. You can now preview
the result at 'https://hackage.haskell.org/package/postgrest-9.0.0/candidate'.
To upload non-candidate documentation, use 'cabal upload --publish'.

# The above were just for generating a candidate for CI we should use the following directly
$ cabal upload --publish dist-newstyle/sdist/postgrest-9.0.0.tar.gz
$ cabal upload -d --publish dist-newstyle/postgrest-9.0.0-docs.tar.gz

We should probably clear some of those warnings with flags in the .cabal file.

References:

sternenseemann commented 1 year ago

Timely hackage releases would be appreciated!

steve-chavez commented 1 year ago

There are some ready made Github actions nowadays:

However this is currently blocked bc we use a fork of https://github.com/haskellari/postgresql-libpq:

https://github.com/PostgREST/postgrest/blob/e889ded32bdd00fd2795cc550a0f9cdc7fd06396/nix/overlays/haskell-packages.nix#L32-L40

https://github.com/PostgREST/postgresql-libpq, which is not on Hackage.