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 master are signed off by the same
# committer (taken from the HEAD commit).
[[ ! "$(git log --invert-grep --grep="Signed-off-by: $(git show -s --pretty="%cn <%ce>" HEAD)" origin/master..)" ]]
- setup: |
go version
go env
go get -u golang.org/x/lint/golint
go get -u github.com/securego/gosec/cmd/gosec
go get -u git.sr.ht/~samwhited/checkdoc
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 .)" ]
golint -set_exit_status ./...
gosec ./...
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