Skip to content

Semiautomatic hackage releases #2163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .github/workflows/hackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Hackage

on:
push:
branches:
- '*-hackage'

jobs:
check-and-upload-tarballs:
runs-on: ubuntu-latest
strategy:
matrix:
package: ["hie-compat", "hls-graph", "shake-bench",
"hls-plugin-api", "ghcide", "hls-test-utils",
"hls-brittany-plugin", "hls-floskell-plugin", "hls-fourmolu-plugin",
"hls-ormolu-plugin", "hls-stylish-haskell-plugin",
"hls-class-plugin", "hls-eval-plugin", "hls-explicit-imports-plugin",
"hls-haddock-comments-plugin", "hls-hlint-plugin",
"hls-module-name-plugin", "hls-pragmas-plugin",
"hls-refine-imports-plugin", "hls-retrie-plugin",
"hls-splice-plugin", "hls-tactics-plugin",
"hls-call-hierarchy-plugin",
"haskell-language-server"]
ghc: ["8.10.7", "8.8.4", "8.6.5"]

steps:

- uses: actions/checkout@v2
with:
submodules: true

- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.4'

- name: Cache Cabal
uses: actions/cache@v2
env:
cache-name: cache-cabal
with:
path: |
~/.cabal/packages
~/.cabal/store
key: v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
restore-keys: |
v2-${{ runner.os }}-${{ matrix.ghc }}-bench-${{ hashFiles('cabal.project') }}
v2-${{ runner.os }}-${{ matrix.ghc }}-build-
v2-${{ runner.os }}-${{ matrix.ghc }}

- name: "Run cabal check"
run: |
if [[ ${{ matrix.package }} == *plugin ]]; then
cd plugins
fi
if [[ ${{ matrix.package }} != haskell-language-server ]]; then
cd ${{ matrix.package }}
fi
cabal check

- name: "Generate package dist tarball"
id: generate-dist-tarball
run: |
if [[ ${{ matrix.package }} == haskell-language-server ]]; then
cabal sdist --builddir=./
else
cabal sdist ${{ matrix.package }} --builddir=./
fi
echo ::set-output name=path::$(ls ./sdist/${{ matrix.package }}-*)

- name: "Unpack package source in an isolated location"
run: cabal unpack ${{ steps.generate-dist-tarball.outputs.path }} --destdir=./incoming

- name: "Try to get the current hackage version"
id: get-hackage-version
run: |
cd ./incoming
if cabal get $(ls -d ${{ matrix.package }}-*) --destdir=../current; then
echo ::set-output name=exists::true
fi

- name: "Compare the incoming and the current hackage version of the package"
id: compare-current-version
if: steps.get-hackage-version.exists == 'true'
run: |
# This will throw an error if there is any difference cause we have to bump up the package version
diff -qr -x "*.md" -x "data" $(ls -d ./incoming/${{ matrix.package }}-*) $(ls -d ./current/${{ matrix.package }}-*)

- name: "Create appropiate cabal.project"
if: steps.get-hackage-version.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
echo "packages: . ../../* ../../plugins/*" > cabal.project
# TODO: remove when not needed
echo "allow-newer: Chart-diagrams:diagrams-core, SVGFonts:diagrams-core" >> cabal.project
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only needed to build the benchmark suite of ghcide. The benchmark suite is not a requirement for uploading to Hackage imho, and should be skipped

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, but to use a simple autogenerated cabal.project with packages: . ../../* ../../plugins/* cabal has to find a build plan for shake-bench. The alternative is a cabal project listing explicitly all packages but shake-bench.
Otoh in theory you should be able to run the benchmarks (like tests) with the hackage version too, and ideally those allow-newer should be removed to allow it


- name: "Build all package components in isolation"
if: steps.get-hackage-version.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
cabal build --enable-tests --enable-benchmarks
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cabal build --enable-tests --enable-benchmarks
cabal build --enable-tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally benchmarks should be able to run using the hackage version


- name: "Generate haddock for hackage"
if: steps.get-hackage-version.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
cabal haddock --haddock-for-hackage

- name: "Upload package dist tarball"
if: steps.get-hackage-version.exists != 'true'
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.package }}
path: ${{ steps.generate-dist-tarball.outputs.path }}

upload-candidate:
needs: check-and-upload-tarballs
runs-on: ubuntu-latest
steps:

- uses: actions/download-artifact@v2
with:
path: packages

- name: "Join all tarballs"
run: find ./packages -type f -name '*.tar.gz' -exec cp {} ./packages \;

- name: "Upload all tarballs to hackage"
uses: haskell-actions/hackage-publish@v1
with:
hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
packagesPath: packages
publish: false
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cabal-version: 2.4
name: hls-call-hierarchy-plugin
version: 1.0.0.2
synopsis: Call hierarchy plugin for Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-call-hierarchy-plugin#readme>

license: Apache-2.0
license-file: LICENSE
author: Lei Zhu
Expand All @@ -21,7 +24,7 @@ library

hs-source-dirs: src
build-depends:
, aeson
, aeson >=1.5.2.0
, base >=4.12 && <5
, bytestring
, containers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cabal-version: 2.2
name: hls-explicit-imports-plugin
version: 1.0.0.4
synopsis: Explicit imports plugin for Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
license: Apache-2.0
license-file: LICENSE
author: Pepe Iborra
Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-hlint-plugin/hls-hlint-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: hls-hlint-plugin
version: 1.0.1.1
synopsis: Hlint integration plugin with Haskell Language Server
description:
Please see Haskell Language Server Readme (https://github.com/haskell/haskell-language-server#readme)
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>

license: Apache-2.0
license-file: LICENSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cabal-version: 2.2
cabal-version: 2.4
name: hls-refine-imports-plugin
version: 1.0.0.1
synopsis: Refine imports plugin for Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
license: Apache-2.0
license-file: LICENSE
author: rayshih
Expand Down
2 changes: 2 additions & 0 deletions plugins/hls-retrie-plugin/hls-retrie-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cabal-version: 2.2
name: hls-retrie-plugin
version: 1.0.1.1
synopsis: Retrie integration plugin for Haskell Language Server
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
license: Apache-2.0
license-file: LICENSE
author: Pepe Iborra
Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-splice-plugin/hls-splice-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ synopsis:
HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes

description:
HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes.
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>

license: Apache-2.0
license-file: LICENSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cabal-version: 2.4
name: hls-stylish-haskell-plugin
version: 1.0.0.2
synopsis: Integration with the Stylish Haskell code formatter
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
license: Apache-2.0
license-file: LICENSE
author: The Haskell IDE Team
Expand Down
3 changes: 2 additions & 1 deletion plugins/hls-tactics-plugin/hls-tactics-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ category: Development
name: hls-tactics-plugin
version: 1.3.0.0
synopsis: Wingman plugin for Haskell Language Server
description: Please see README.md
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
author: Sandy Maguire, Reed Mullanix
maintainer: sandy@sandymaguire.me
copyright: Sandy Maguire, Reed Mullanix
Expand Down