rickub/clipublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/rickub/cli.git
git clone ssh://git@rickub.com/rickub/cli.git
Initial import of the rickub CLI as a standalone public project 1a1d430Unverified · on main · Olivier Girardot · 7h ago
ci.yml · 69 lines · 1.8 KBYAML Blame HistoryRaw
 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
name: CI

# Fast feedback on every pull request and on every push to main.
# NOTE: this workflow deliberately has NO workflow_dispatch trigger — the rickub
# dispatch API fires *every* dispatchable workflow on a ref, so only
# release.yml may declare workflow_dispatch. See RELEASING.md.
on:
  push:
    branches:
      - main
  pull_request:

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: true

jobs:
  check:
    name: fmt / vet / test / build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
          cache: true

      - name: gofmt
        run: |
          set -euo pipefail
          unformatted="$(gofmt -l .)"
          if [ -n "${unformatted}" ]; then
            echo "::error::The following files are not gofmt-formatted:"
            echo "${unformatted}"
            echo
            echo "Run: gofmt -w ."
            gofmt -d .
            exit 1
          fi
          echo "gofmt: all files formatted"

      - name: go vet
        run: go vet ./...

      - name: go test
        run: go test ./... -count=1

      - name: go build
        run: |
          set -euo pipefail
          go build ./...
          CGO_ENABLED=0 go build -trimpath -o "${RUNNER_TEMP}/rickub" .

      - name: Cross-compilation smoke test
        # The runner fleet is Linux/amd64 only, so releases cross-compile every
        # target. Catch a break here rather than in rc.yml/release.yml.
        run: |
          set -euo pipefail
          for target in linux/arm64 darwin/amd64 darwin/arm64; do
            echo "==> ${target}"
            CGO_ENABLED=0 GOOS="${target%%/*}" GOARCH="${target##*/}" \
              go build -trimpath -o /dev/null .
          done