Skip to content
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

feat: enforce dependency on released versions of packages #12740

Merged
merged 21 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a41717a
feat: enforce dependency on released versions of packages
galargh Nov 27, 2024
dd55bbe
test: intentionally break the dependency check
galargh Nov 28, 2024
3105ba8
fix: check out the submodules recursively
galargh Nov 28, 2024
ee01e18
fix: the error message provided by the dependency checker
galargh Nov 28, 2024
e5aa009
Revert "test: intentionally break the dependency check"
galargh Nov 28, 2024
36da613
chore: add github.com/quic-go/webtransport-go to allowed unreleased d…
galargh Nov 28, 2024
90cc239
Merge remote-tracking branch 'origin/master' into ci/dependency-checker
galargh Dec 9, 2024
e18cc37
chore: make the dependency checker operate on go.mod
galargh Dec 9, 2024
01b45ef
chore: document dependencies ignored in the checker
galargh Dec 9, 2024
6e0bc35
docs: update the depednency conventions section
galargh Dec 9, 2024
c119ac0
Update dependency-check.yml
galargh Dec 12, 2024
ffbecb5
Update dependency-check.yml
galargh Dec 12, 2024
2fda23e
Update dependency-check.yml
galargh Dec 12, 2024
942049f
Update dependency-check.yml
galargh Dec 12, 2024
55b0578
Update CONTRIBUTING.md
galargh Dec 12, 2024
c937dc0
Update dependency-check.yml
galargh Dec 12, 2024
688eae1
Update dependency-check.yml
galargh Dec 12, 2024
42fc4b4
chore: add step names in the dependency checker
galargh Dec 12, 2024
a422aed
Merge remote-tracking branch 'origin/master' into ci/dependency-checker
galargh Dec 13, 2024
b6c46d4
fix: the v0.0.0 or vX.Y.Z regex
galargh Dec 13, 2024
87d5e41
feat(ci): go list check versions available for untagged dependencies …
rvagg Dec 18, 2024
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
101 changes: 101 additions & 0 deletions .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Dependency Check

on:
pull_request:
paths:
- 'go.mod'
- 'go.sum'
- '.github/workflows/dependency-check.yml'

jobs:
dependency-check:
runs-on: ubuntu-latest
name: Dependency Check
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- id: dependencies
env:
ALLOWED: |
[
{
"Path": "github.com/filecoin-project/go-data-transfer/v2",
"Version": "v2.0.0-rc7",
"Reason": "unknown"
},
rvagg marked this conversation as resolved.
Show resolved Hide resolved
{
"Path": "github.com/filecoin-project/go-state-types",
"Version": "v0.16.0-dev",
"Reason": "unknown"
},
{
"Path": "github.com/syndtr/goleveldb",
"Version": "v1.0.1-0.20210819022825-2ae1ddf74ef7",
"Reason": "unknown"
},
{
"Path": "github.com/xorcare/golden",
"Version": "v0.6.1-0.20191112154924-b87f686d7542",
"Reason": "unknown"
},
{
"Path": "github.com/xordataexchange/crypt",
"Version": "v0.0.3-0.20170626215501-b2862e3d0a77",
"Reason": "unknown"
},
{
"Path": "github.com/yugabyte/pgx/v5",
"Version": "v5.5.3-yb-2",
"Reason": "unknown"
},
{
"Path": "go.dedis.ch/kyber/v4",
"Version": "v4.0.0-pre2.0.20240924132404-4de33740016e",
"Reason": "unknown"
},
{
"Path": "gopkg.in/check.v1",
"Version": "v1.0.0-20201130134442-10cb98267c6c",
"Reason": "unknown"
},
{
"Path": "gopkg.in/tomb.v1",
"Version": "v1.0.0-20141024135613-dd632973f1e7",
"Reason": "unknown"
},
{
"Path": "honnef.co/go/tools",
"Version": "v0.0.1-2020.1.4",
"Reason": "unknown"
},
{
"Path": "github.com/quic-go/webtransport-go",
"Version": "v0.8.1-0.20241018022711-4ac2c9250e66",
"Reason": "unknown"
}
]
run: |
echo "unreleased<<EOF" >> $GITHUB_OUTPUT
go list -m -json all |
jq -s '
(
map({Path: .Path, Version: .Version}) |
map(select(.Version | test("^v\\d+\\.\\d+\\.\\d+-")?)) |
map(select(.Version | test("^v0\\.0\\.0-")? | not))
BigLep marked this conversation as resolved.
Show resolved Hide resolved
) - (
env.ALLOWED | fromjson |
map({Path: .Path, Version: .Version})
)
' | tee -a $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- if: steps.dependencies.outputs.unreleased != '[]'
env:
MESSAGE: |
A new unreleased dependency was discovered in this PR. Please do one of the options in [dependency management conventions](https://github.com/filecoin-project/lotus/blob/master/CONTRIBUTING.md#dependency-management)
galargh marked this conversation as resolved.
Show resolved Hide resolved

Unreleased dependencies:
galargh marked this conversation as resolved.
Show resolved Hide resolved
${{steps.dependencies.outputs.unreleased}}
run: |
echo "::error::${MESSAGE//$'\n'/%0A}"
exit 1
10 changes: 9 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Note that this is enforced with https://github.com/filecoin-project/lotus/blob/m

## CHANGELOG Management

To expedite the release process, the CHANGELOG is built-up incrementally.
To expedite the release process, the CHANGELOG is built-up incrementally.
We enforce that each PR updates CHANGELOG.md or signals that the change doesn't need it.
If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
If the change does not require a CHANGELOG.md entry, do one of the following:
Expand All @@ -58,6 +58,14 @@ If the change does not require a CHANGELOG.md entry, do one of the following:

Note that this is enforced with https://github.com/filecoin-project/lotus/blob/master/.github/workflows/changelog.yml

## Dependency Management

We enforce that each dependency on an unreleased version of a package, as long as said package has any released versions (i.e. it is not a `v0.0.0`), is explicitly documented in the `ALLOWED` list stored in [.github/workflows/dependency-check.yml](.github/workflows/dependency-check.yml).
If you are adding such a dependency, please add it to the `ALLOWED` list.
Please note that this requirement applies both to direct and indirect dependencies.

Note that this is enforced with https://github.com/filecoin-project/lotus/blob/master/.github/workflows/dependency-check.yml
galargh marked this conversation as resolved.
Show resolved Hide resolved

## Markdown Conventions
We optimize our markdown files for viewing on GitHub. That isn't to say other syntaxes can't be used, but that is the flavor we focus on and at the minimum don't want to break.

Expand Down
Loading