forked from cloudquery/cloudquery
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (137 loc) · 4.65 KB
/
Copy pathsource_azure.yml
File metadata and controls
141 lines (137 loc) · 4.65 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Source Plugin Azure Workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths:
- "plugins/source/azure/**"
- ".github/workflows/source_azure.yml"
push:
branches:
- main
paths:
- "plugins/source/azure/**"
- ".github/workflows/source_azure.yml"
jobs:
plugins-source-azure:
timeout-minutes: 30
name: "plugins/source/azure"
runs-on: large-ubuntu-monorepo
defaults:
run:
working-directory: ./plugins/source/azure
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Go 1.x
uses: erezrokah/setup-go@feat/add_cache_prefix
with:
go-version-file: plugins/source/azure/go.mod
cache: true
cache-dependency-path: plugins/source/azure/go.sum
cache-key-prefix: test-cache-
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
working-directory: plugins/source/azure
args: "--config ../../.golangci.yml"
skip-pkg-cache: true
skip-build-cache: true
- name: Setup CloudQuery
if: github.event_name == 'pull_request'
uses: cloudquery/setup-cloudquery@v3
with:
version: 'v3.13.0'
- name: gen
if: github.event_name == 'pull_request'
run: make gen
- name: Fail if generation updated files
if: github.event_name == 'pull_request'
run: test "$(git status -s | wc -l)" -eq 0 || (git status -s; exit 1)
- name: Build
run: go build .
- name: Test
run: make test
validate-release:
timeout-minutes: 30
runs-on: large-ubuntu-monorepo
env:
CGO_ENABLED: 0
steps:
- name: Checkout
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push'
uses: actions/checkout@v3
- uses: actions/cache@v3
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push'
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-1.20.5-release-cache-${{ hashFiles('plugins/source/azure/go.sum') }}
restore-keys: |
${{ runner.os }}-go-1.20.5-release-cache-plugins-source-azure
- name: Set up Go
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push'
uses: actions/setup-go@v3
with:
go-version-file: plugins/source/azure/go.mod
- name: Install GoReleaser
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push'
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
- name: Run GoReleaser Dry-Run
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push'
run: goreleaser release --snapshot --clean --skip-validate --skip-publish --skip-sign -f ./plugins/source/azure/.goreleaser.yaml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
test-policies:
timeout-minutes: 30
runs-on: large-ubuntu-monorepo
defaults:
run:
working-directory: ./plugins/source/azure
services:
postgres:
image: postgres:11
env:
POSTGRES_PASSWORD: pass
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go 1.x
uses: erezrokah/setup-go@feat/add_cache_prefix
with:
go-version-file: plugins/source/azure/go.mod
cache: true
cache-dependency-path: plugins/source/azure/go.sum
cache-key-prefix: policies-cache-
- name: Build
run: go build .
- name: Setup CloudQuery
uses: cloudquery/setup-cloudquery@v3
with:
version: 'v3.10.1'
- name: Migrate DB
run: cloudquery migrate test/policy_cq_config.yml
env:
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres
- name: Run all policies
run: cd policies && psql -h localhost -p 5432 -U postgres -d postgres -w -f ./policy.sql
env:
PGPASSWORD: pass