-
Notifications
You must be signed in to change notification settings - Fork 552
106 lines (102 loc) · 3.04 KB
/
cli.yml
File metadata and controls
106 lines (102 loc) · 3.04 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CLI Workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths:
- "cli/**"
- ".github/workflows/cli.yml"
push:
branches:
- main
paths:
- "cli/**"
- ".github/workflows/cli.yml"
env:
CLOUDQUERY_API_KEY: ${{ secrets.CLOUDQUERY_API_KEY }}
permissions:
contents: read
jobs:
cli:
timeout-minutes: 30
name: "cli"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./cli
strategy:
fail-fast: false
matrix:
os: [ubicloud-standard-2, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Set up Go 1.x
id: setup-go
uses: actions/setup-go@v6
with:
go-version-file: cli/go.mod
cache: false
- uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-test-cli-${{ hashFiles('cli/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-test-cli-
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
if: matrix.os == 'ubicloud-standard-2'
with:
version: v2.10.1
working-directory: cli
- name: Build
run: go build .
- name: Test
run: make test
- name: gen
if: matrix.os == 'ubicloud-standard-2'
run: make gen
- name: Fail if cli files are changed
if: matrix.os == 'ubicloud-standard-2'
run: test "$(git status -s | wc -l)" -eq 0 || (git status -s; exit 1)
validate-release:
timeout-minutes: 30
runs-on: ubicloud-standard-2
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push'
env:
CGO_ENABLED: 0
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@v6
with:
go-version-file: cli/go.mod
cache: false
- uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-release-cache-cli-${{ hashFiles('cli/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ steps.setup-go.outputs.go-version }}-release-cache-cli-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser-pro
version: latest
install-only: true
- name: Run GoReleaser Dry-Run
run: goreleaser release --snapshot --clean --skip=validate,publish,sign -f ./cli/.goreleaser.yaml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}