Skip to content

Commit

Permalink
Merge pull request #1341 from haskell/master2central-nov2024
Browse files Browse the repository at this point in the history
master -> central-server 11/2024
  • Loading branch information
gbaz authored Nov 2, 2024
2 parents c4f3640 + 4b11c7a commit ec45aab
Show file tree
Hide file tree
Showing 27 changed files with 475 additions and 226 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/dependabot-auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request
name: Dependabot auto-approve
on: pull_request

permissions:
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
34 changes: 19 additions & 15 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/andreasabel/haskell-ci
#
# version: 0.17.20231012
# version: 0.19.20240630
#
# REGENDATA ("0.17.20231012",["github","hackage-server.cabal"])
# REGENDATA ("0.19.20240630",["github","hackage-server.cabal"])
#
name: Haskell-CI
on:
Expand All @@ -32,19 +32,24 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.8.1
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.8.1
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.3
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.6.3
compilerVersion: 9.8.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.7
- compiler: ghc-9.6.5
compilerKind: ghc
compilerVersion: 9.4.7
compilerVersion: 9.6.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.8
compilerKind: ghc
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
Expand Down Expand Up @@ -74,11 +79,10 @@ jobs:
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
apt-get update
apt-get install -y libbrotli-dev libgd-dev
env:
Expand All @@ -98,7 +102,7 @@ jobs:
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" ; else echo "ARG_TESTS=--disable-tests" >> "$GITHUB_ENV" ; fi
Expand Down Expand Up @@ -183,15 +187,15 @@ jobs:
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(Cabal|Cabal-syntax|hackage-server|parsec|process|text)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(Cabal|Cabal-syntax|hackage-server|parsec|process|text)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: restore cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
Expand Down Expand Up @@ -221,7 +225,7 @@ jobs:
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: save cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: always()
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/nix-flake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
nix:
strategy:
fail-fast: false
fail-fast: true
matrix:
os:
- ubuntu-latest
Expand All @@ -18,16 +18,23 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY=
substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/
- uses: cachix/cachix-action@v12
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY=
substituters = https://cache.nixos.org/ https://hackage-server.cachix.org/
- uses: cachix/cachix-action@v15
with:
# https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions
name: hackage-server
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: "Check `nix develop` shell"
run: nix develop --check

- name: "Check `nix develop` shell can run command"
run: nix develop --command "echo"

- run: nix build

- continue-on-error: false
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
central-server branch: the hackage.haskell.org instance
=======================================================

This is the branch for the "official" Hackage server at hackage.haskell.org. Most changes should not be here, but should be made to master.

# General Documentation
=======
[![Build Status](https://travis-ci.org/haskell/hackage-server.png?branch=master)](https://travis-ci.org/haskell/hackage-server)
[![Build status](https://github.com/haskell/hackage-server/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/haskell-ci.yml)
[![Build status](https://github.com/haskell/hackage-server/actions/workflows/nix-shell.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/nix-shell.yml)
20 changes: 0 additions & 20 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,6 @@ packages:

-- This project config requires cabal 2.4 or later

-- If in doubt, use GHC 8.8 to build hackage-server; see
-- 'tested-with' in 'hackage-server.cabal' for a list of currently
-- CI-validated GHC versions
--
-- with-compiler: ghc-8.8


allow-newer: rss:time, rss:base

-- Andreas, 2022-10-28: `Cabal-3.8.1.0` wants `process >= 1.6.14`
-- which is too new for the `ghc < 9.4` package that is pulled in
-- by `doctest-parallel`.
-- Since, Cabal-3.8.1.0 has no reason to want such a new version
-- of process, we can solve the conflict here by allowing
-- `Cabal` to use the shipped version of `process`.
-- This workaround can be removed once `Cabal-3.8` drops
-- its (unreasonable) constraint on `process`.
-- See: https://github.com/haskell/cabal/issues/8554
allow-older: Cabal:process

-----------------------------------------------------------------------------
-- Anti-constraints

Expand Down
46 changes: 42 additions & 4 deletions datafiles/static/hackage.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,28 @@ h4 { font-size: 100%; /* 13px */ }
h5 { font-size: 100%; /* 13px */ }
h6 { font-size: 100%; /* 13px */ }

select, input, button, textarea {
select, input, button, textarea, input::file-selector-button {
font-size: 1rem;
margin: 0.5em;
padding: 0.1em;
padding: 0.5em 0.8em;
border: 1px solid #444;
border-radius: 3px;
background: #eee;
}

select:hover, input:hover, button:hover, textarea:hover, input::file-selector-button:hover {
background: #dcdcdc;
}

input[type=file] {
background: none;
border: 0;
}

@media (prefers-color-scheme: dark) {
select, input, button, textarea, input::file-selector-button {
border: 0;
}
}

table {
Expand Down Expand Up @@ -267,9 +285,21 @@ pre + pre {
margin-top: 0.5em;
}

@media (prefers-color-scheme: dark) {
blockquote {
border-left: 3px solid #2f2842;
background-color: #4c4771;
}
}

@media (prefers-color-scheme: light) {
blockquote {
border-left: 3px solid #c7a5d3;
background-color: #eee4f1;
}
}

blockquote {
border-left: 3px solid #c7a5d3;
background-color: #eee4f1;
margin: 0.5em;
padding: 0.0005em 0.3em 0.5em 0.5em;
}
Expand Down Expand Up @@ -1147,6 +1177,14 @@ a.deprecated[href]:visited {
color: #61B01E;
}

.lib-contents {
margin-left: 20px;
}

.lib-contents > h3 {
margin: 0.7em 0;
}

/* Paginator */
#paginatorContainer {
display: flex;
Expand Down
10 changes: 10 additions & 0 deletions datafiles/templates/Html/package-page.html.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<div style="font-size: small">
[ $tags$ ]
[ <a href="/package/$package.name$/tags/edit">Propose Tags</a> ]
[ <a href="https://github.com/haskell/security-advisories/blob/main/CONTRIBUTING.md">Report a vulnerability</a> ]
</div>

$if(isDeprecated)$
Expand Down Expand Up @@ -139,6 +140,15 @@
<td>$package.buildDepends$</td>
</tr>

$if(package.optional.hasTestedWith)$
<tr>
<th>Tested with</th>
<td class="word-wrap">
$package.optional.testedWith$
</td>
</tr>
$endif$

<tr>
<th>License</th>
<td class="word-wrap">$package.license$</td>
Expand Down
14 changes: 13 additions & 1 deletion exes/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{-# LANGUAGE CPP #-}

{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}

module Main where

import qualified Distribution.Server as Server
Expand Down Expand Up @@ -65,7 +68,11 @@ main :: IO ()
main = topHandler $ do
hSetBuffering stdout LineBuffering
args <- getArgs
#if !MIN_VERSION_Cabal(3,12,0)
case commandsRun (globalCommand commands) commands args of
#else
commandsRun (globalCommand commands) commands args >>= \case
#endif
CommandHelp help -> printHelp help
CommandList opts -> printOptionsList opts
CommandErrors errs -> printErrors errs
Expand All @@ -79,6 +86,7 @@ main = topHandler $ do

where
printHelp help = getProgName >>= putStr . help
printOptionsList :: [String] -> IO ()
printOptionsList = putStr . unlines
printErrors errs = do
putStr (intercalate "\n" errs)
Expand Down Expand Up @@ -154,7 +162,11 @@ optionVerbosity getter setter =
"Control verbosity (n is 0--3, default verbosity level is 1)"
getter setter
(optArg "n" (fmap Flag Verbosity.flagToVerbosity)
(Flag Verbosity.verbose)
(
#if MIN_VERSION_Cabal(3,12,0)
show Verbosity.verbose,
#endif
Flag Verbosity.verbose)
(fmap (Just . showForCabal) . flagToList))

optionStateDir :: (a -> Flag FilePath)
Expand Down
24 changes: 12 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ec45aab

Please sign in to comment.