Skip to content

Commit 4b668de

Browse files
authored
Merge pull request #39 from input-output-hk/jasagredo/cabal-check-fixes
Move CHANGELOGS to `extra-doc-files`
2 parents 7f264e6 + ec7d8af commit 4b668de

14 files changed

+176
-82
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ concurrency:
66

77
on:
88
pull_request:
9+
branches:
10+
- main
911
merge_group:
1012

1113
jobs:
1214
consensus-changelog:
1315

1416
name: Changelog sanity check
1517

16-
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
18+
if: ${{ !github.event.pull_request.draft }}
1719

1820
runs-on: ubuntu-latest
1921

@@ -29,7 +31,7 @@ jobs:
2931

3032
- uses: actions/checkout@v3
3133
with:
32-
ref: ${{ env.GITHUB_BASE_REF }}
34+
ref: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
3335
path: 'main'
3436

3537
- run: CI=1 ./this-pr/scripts/ci/check-changelogs.sh main this-pr

.github/workflows/haskell-build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ concurrency:
77
on:
88
pull_request:
99
merge_group:
10-
push:
11-
branches:
12-
- main
1310

1411
jobs:
1512
check-cabal-files:
@@ -29,7 +26,7 @@ jobs:
2926

3027
build:
3128
runs-on: ${{ matrix.os }}
32-
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
29+
if: ${{ !github.event.pull_request.draft }}
3330

3431
strategy:
3532
fail-fast: false

.github/workflows/yarn-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Yarn Build
22

33
on:
44
pull_request:
5-
merge_group:
5+
branches:
6+
- main
67

78
jobs:
89
build:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ use the provided issue templates.
143143

144144
We have several sources of documentation:
145145

146-
- [Haddocks](https://input-output-hk.github.io/ouroboros-consensus/haddocks):
146+
- [Haddocks](https://input-output-hk.github.io/ouroboros-consensus/haddocks/):
147147
our code is full of haddock annotations and comments that try to clarify
148148
expected behaviors and subtleties. Reading through the code should provide
149149
most of the information on how is Consensus implemented.
150150

151-
- [Website](https://input-output-hk.github.io/ouroboros-consensus): this website
151+
- [Website](https://input-output-hk.github.io/ouroboros-consensus/): this website
152152
provides access to the markdown documentation to which step by step we want to
153153
move the bulk of the "higher level documentation" as well as achitectural
154154
documentation.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Patch
9+
10+
- A bullet item for the Patch category.
11+
12+
-->
13+
<!--
14+
### Non-Breaking
15+
16+
- A bullet item for the Non-Breaking category.
17+
18+
-->
19+
<!--
20+
### Breaking
21+
22+
- A bullet item for the Breaking category.
23+
24+
-->

ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
cabal-version: 3.0
2-
name: ouroboros-consensus-cardano
3-
version: 0.5.0.0
1+
cabal-version: 3.0
2+
name: ouroboros-consensus-cardano
3+
version: 0.5.0.0
44
synopsis:
55
The instantation of the Ouroboros consensus layer used by Cardano
66

77
description:
88
The instantation of the Ouroboros consensus layer used by Cardano.
99

10-
license: Apache-2.0
10+
license: Apache-2.0
1111
license-files:
1212
LICENSE
1313
NOTICE
1414

15-
copyright: 2019-2023 Input Output Global Inc (IOG)
16-
author: IOHK Engineering Team
17-
maintainer: [email protected]
18-
category: Network
19-
build-type: Simple
20-
extra-source-files: CHANGELOG.md
15+
copyright: 2019-2023 Input Output Global Inc (IOG)
16+
author: IOHK Engineering Team
17+
maintainer: [email protected]
18+
category: Network
19+
build-type: Simple
20+
extra-doc-files: CHANGELOG.md
2121

2222
source-repository head
2323
type: git
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Patch
9+
10+
- A bullet item for the Patch category.
11+
12+
-->
13+
<!--
14+
### Non-Breaking
15+
16+
- A bullet item for the Non-Breaking category.
17+
18+
-->
19+
<!--
20+
### Breaking
21+
22+
- A bullet item for the Breaking category.
23+
24+
-->

ouroboros-consensus-diffusion/ouroboros-consensus-diffusion.cabal

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
cabal-version: 3.0
2-
name: ouroboros-consensus-diffusion
3-
version: 0.5.0.0
4-
synopsis: Integration for the Ouroboros Network layer
1+
cabal-version: 3.0
2+
name: ouroboros-consensus-diffusion
3+
version: 0.5.0.0
4+
synopsis: Integration for the Ouroboros Network layer
55
description:
66
Top level integration for consensus & network layers of the Ouroboros blockchain protocol.
77

8-
license: Apache-2.0
8+
license: Apache-2.0
99
license-files:
1010
LICENSE
1111
NOTICE
1212

13-
copyright: 2022-2023 Input Output Global Inc (IOG)
14-
author: IOHK Engineering Team
15-
maintainer: [email protected]
16-
category: Network
17-
build-type: Simple
18-
extra-source-files: CHANGELOG.md
13+
copyright: 2022-2023 Input Output Global Inc (IOG)
14+
author: IOHK Engineering Team
15+
maintainer: [email protected]
16+
category: Network
17+
build-type: Simple
18+
extra-doc-files: CHANGELOG.md
1919

2020
source-repository head
2121
type: git
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Patch
9+
10+
- A bullet item for the Patch category.
11+
12+
-->
13+
<!--
14+
### Non-Breaking
15+
16+
- A bullet item for the Non-Breaking category.
17+
18+
-->
19+
<!--
20+
### Breaking
21+
22+
- A bullet item for the Breaking category.
23+
24+
-->

ouroboros-consensus-protocol/ouroboros-consensus-protocol.cabal

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
cabal-version: 3.0
2-
name: ouroboros-consensus-protocol
3-
version: 0.5.0.0
4-
synopsis: Cardano consensus protocols
5-
description: Cardano consensus protocols.
6-
license: Apache-2.0
1+
cabal-version: 3.0
2+
name: ouroboros-consensus-protocol
3+
version: 0.5.0.0
4+
synopsis: Cardano consensus protocols
5+
description: Cardano consensus protocols.
6+
license: Apache-2.0
77
license-files:
88
LICENSE
99
NOTICE
1010

11-
copyright: 2021-2023 Input Output Global Inc (IOG)
12-
author: IOHK Formal methods team
13-
maintainer: [email protected]
14-
category: Network
15-
extra-source-files: CHANGELOG.md
11+
copyright: 2021-2023 Input Output Global Inc (IOG)
12+
author: IOHK Formal methods team
13+
maintainer: [email protected]
14+
category: Network
15+
extra-doc-files: CHANGELOG.md
1616

1717
source-repository head
1818
type: git
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Patch
9+
10+
- A bullet item for the Patch category.
11+
12+
-->
13+
<!--
14+
### Non-Breaking
15+
16+
- A bullet item for the Non-Breaking category.
17+
18+
-->
19+
<!--
20+
### Breaking
21+
22+
- A bullet item for the Breaking category.
23+
24+
-->

ouroboros-consensus/ouroboros-consensus.cabal

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
cabal-version: 3.0
2-
name: ouroboros-consensus
3-
version: 0.5.0.0
4-
synopsis: Consensus layer for the Ouroboros blockchain protocol
5-
description: Consensus layer for the Ouroboros blockchain protocol.
6-
license: Apache-2.0
1+
cabal-version: 3.0
2+
name: ouroboros-consensus
3+
version: 0.5.0.0
4+
synopsis: Consensus layer for the Ouroboros blockchain protocol
5+
description: Consensus layer for the Ouroboros blockchain protocol.
6+
license: Apache-2.0
77
license-files:
88
LICENSE
99
NOTICE
1010

11-
copyright: 2019-2023 Input Output Global Inc (IOG)
12-
author: IOHK Engineering Team
13-
maintainer: [email protected]
14-
category: Network
15-
build-type: Simple
16-
extra-source-files: CHANGELOG.md
11+
copyright: 2019-2023 Input Output Global Inc (IOG)
12+
author: IOHK Engineering Team
13+
maintainer: [email protected]
14+
category: Network
15+
build-type: Simple
16+
extra-doc-files: CHANGELOG.md
1717

1818
source-repository head
1919
type: git

scripts/ci/check-changelogs.sh

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
# set -x
34
# For each one of the two bundles, check that:
45
# (1) the version in the changelog is the same as the package's cabal file
56
# (2) if the version was changed from the last one on the changelog then there
@@ -10,35 +11,38 @@
1011
# ./scripts/ci/check-changelogs.sh main
1112

1213
# CI uses:
13-
# ./this-pr/scripts/ci/check-changelogs.sh main this-pr
14+
# CI=1 ./this-pr/scripts/ci/check-changelogs.sh main this-pr
1415

1516
TARGET=${1:-"main"}
1617
BASE=${2:-"."}
1718

1819
function get_last_version {
20+
cd $BASE
1921
if [[ -n $CI ]];
20-
then grep "<a id=" $BASE/$1/CHANGELOG.md | cut -d\' -f2 | cut -d- -f2 | head -n1
22+
then grep "<a id=" $1/CHANGELOG.md | cut -d\' -f2 | cut -d- -f2 | head -n1
2123
else grep "<a id=" $1/CHANGELOG.md | cut -d\' -f2 | cut -d- -f2 | head -n1
2224
fi
2325
}
2426

2527
function cabal_files_version {
28+
cd $BASE
2629
if [[ -n $CI ]];
27-
then cat $BASE/$1/$1.cabal | grep "^version" | rev | cut -d' ' -f1 | rev
30+
then cat $1/$1.cabal | grep "^version" | rev | cut -d' ' -f1 | rev
2831
else cat $1/$1.cabal | grep "^version" | rev | cut -d' ' -f1 | rev
2932
fi
3033
}
3134

3235
function this_merge_updates_version {
36+
cd $BASE
3337
if [[ -n $CI ]];
34-
then diff $TARGET/$1/$1.cabal $BASE/$1/$1.cabal | grep "^> version"
35-
else git diff $TARGET HEAD -- $1/$1.cabal | grep "^+version"
38+
then diff -w ../$TARGET/$1/$1.cabal $1/$1.cabal | grep "^> version"
39+
else git diff -b $TARGET HEAD -- $1/$1.cabal | grep "^+version"
3640
fi
3741
}
3842

3943
function this_merge_adds_fragment {
4044
if [[ -n $CI ]];
41-
then echo "$(($(ls -A1 $TARGET/$1/changelog.d | wc -l) - $(ls -A1 $BASE/$1/changelog.d | wc -l)))"
45+
then echo "$(($(ls -A1 $BASE/$1/changelog.d | wc -l) - $(ls -A1 $TARGET/$1/changelog.d | wc -l)))"
4246
else git diff $TARGET HEAD --name-only --diff-filter=A | grep $1/changelog.d | wc -l
4347
fi
4448
}
@@ -47,27 +51,23 @@ function check {
4751
pkg=$1
4852

4953
echo "Checking consistency of $pkg"
50-
if [[ -d $pkg/changelog.d ]]; then
51-
version=$(cabal_files_version $pkg)
52-
last_version=$(get_last_version $pkg)
53-
updated_versions=$(this_merge_updates_version $pkg)
54-
adds_fragment=$(this_merge_adds_fragment $pkg)
54+
version=$(cabal_files_version $pkg)
55+
last_version=$(get_last_version $pkg)
56+
updated_versions=$(this_merge_updates_version $pkg)
57+
adds_fragment=$(this_merge_adds_fragment $pkg)
5558

56-
if [[ $version != $last_version ]]; then
57-
echo "ERROR: In $pkg, last version in the changelog ($last_version) is not the same as in the package's cabal file ($version)"
58-
exit 1
59-
elif [[ -n "$updated_versions" && $(ls -A1 $BASE/$pkg/changelog.d | wc -l) != 1 ]]; then
60-
echo "ERROR: In $pkg, last commit updated the version but there are repkging changelog fragments"
61-
exit 1
62-
elif [[ -z "$updated_versions" && $adds_fragment -lt 1 ]]; then
63-
echo "ERROR: In $pkg, there are no new changelog fragments comparing to pkg. This is enforced. Push an empty fragment if there is nothing to mention."
64-
echo " new fragments - old fragments = $adds_fragment"
65-
exit 1
66-
else
67-
printf "OK: %s\n\n" $last_version
68-
fi
59+
if [[ $version != $last_version ]]; then
60+
echo "ERROR: In $pkg, last version in the changelog ($last_version) is not the same as in the package's cabal file ($version)"
61+
exit 1
62+
elif [[ -n "$updated_versions" && $(ls -A1 $BASE/$pkg/changelog.d | wc -l) != 1 ]]; then
63+
echo "ERROR: In $pkg, last commit updated the version but there are remaining changelog fragments"
64+
exit 1
65+
elif [[ -z "$updated_versions" && $adds_fragment -lt 1 ]]; then
66+
echo "ERROR: In $pkg, there are no new changelog fragments comparing to pkg. This is enforced. Push an empty fragment if there is nothing to mention."
67+
echo " new fragments - old fragments = $adds_fragment"
68+
exit 1
6969
else
70-
echo "Changelog directory doesn't exist, aren't we migrated yet?"
70+
printf "version: %s\nnew version: %s\nnew fragments: $adds_fragment\nOK\n\n" $version $updated_versions $last_version
7171
fi
7272
}
7373

0 commit comments

Comments
 (0)