~samwhited/xmpp

xmpp/.builds/validate.yml -rw-r--r-- 2.6 KiB
92036897Sam Whited pubsub: allow creating and configuring nodes 9 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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 install honnef.co/go/tools/cmd/staticcheck@latest
      go install github.com/securego/gosec/v2/cmd/gosec@latest
      go install git.sr.ht/~samwhited/checkdoc@latest
      go install mellium.im/checkmd@latest

      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
      # It also does not handle deferred close statements correctly (G307).
      # See: https://github.com/securego/gosec/issues/714
      gosec -exclude=G307 -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