image: alpine/edge
packages:
- go
- git
sources:
- https://git.sr.ht/~samwhited/xmpp
environment:
GO111MODULE: "on"
tasks:
- dco: |
git version
cd xmpp/
function on_err {
cat <<EOF
Failed to sign the Developer Certificate of Origin (DCO)!
Please read the file "DCO" and then, if you agree, sign each of your commits
using:
git commit -s
Or quickly sign the previous commit with:
git commit --amend -s --no-edit
EOF
}
trap on_err ERR
# Check that all commits that aren't in main are signed off by the same
# committer (taken from the HEAD commit).
[[ ! "$(git log --invert-grep --grep="Signed-off-by: $(git show -s --pretty="%an <%ae>" HEAD)" origin/main..)" ]]
- setup: |
go version
go env
go get -u honnef.co/go/tools/cmd/staticcheck
go get -u github.com/securego/gosec/v2/cmd/gosec
go get -u git.sr.ht/~samwhited/checkdoc@main
go get -u mellium.im/checkmd
echo 'export PATH=$(go env GOPATH)/bin:$PATH' >> ~/.buildenv
- lint: |
cd xmpp/
go vet ./...
gofmt -s -l . && [ -z "$(gofmt -s -l .)" ]
staticcheck ./...
# gosec does not handle modules correctly.
# See: https://github.com/securego/gosec/issues/622
gosec -exclude-dir=examples ./...
checkdoc -fileheader.pattern='-' ./... <<EOF
Copyright \d\d\d\d The Mellium Contributors\.
Use of this source code is governed by the BSD 2-clause
license that can be found in the LICENSE file\.
EOF
checkmd .
- validate: |
cd xmpp/
go mod tidy
git diff --exit-code -- go.mod go.sum
cd examples/
for d in ./*/; do
pushd $d
go mod tidy
git diff --exit-code -- go.mod go.sum
popd
done
- contributors: |
cd xmpp/
function on_err {
cat <<EOF
We didn't find you in the CONTRIBUTORS file!
Please read the file "DCO" and then, if you agree, add yourself to the
CONTRIBUTORS file by running:
make CONTRIBUTORS
If you are already in the CONTRIBUTORS file, check that you comitted using
the correct name and password and if not fix your commits or (if they've
already been merged) add a .mailmap entry for yourself.
For more info see https://www.git-scm.com/docs/git-check-mailmap
EOF
}
trap on_err ERR
rm -f CONTRIBUTORS && make CONTRIBUTORS
git diff --exit-code -- CONTRIBUTORS