Repository navigation
70 lines (65 loc) · 2.35 KB
/
Copy pathci.yml
File metadata and controls
70 lines (65 loc) · 2.35 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
# CI workflow for pull requests and pushes to main.
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: true
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.11.4
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: true
- run: go build -o terraform-provider-openmetadata .
resource-test-coverage:
name: Every resource has an acceptance test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check resource → test file mapping
run: |
# Every .go file in internal/resources/ (except common.go) must have a
# matching *_resource_test.go in internal/provider/.
#
# Naming convention:
# internal/resources/my_resource.go
# → internal/provider/my_resource_resource_test.go
#
# To add a new resource, you must also add the corresponding test file.
MISSING=()
for res in internal/resources/*.go; do
base="$(basename "$res" .go)"
[ "$base" = "common" ] && continue
test_file="internal/provider/${base}_resource_test.go"
if [ ! -f "$test_file" ]; then
MISSING+=("$test_file (resource: $res)")
fi
done
if [ ${#MISSING[@]} -gt 0 ]; then
echo "ERROR: The following resource files are missing acceptance tests:"
for m in "${MISSING[@]}"; do
echo " - $m"
done
echo ""
echo "Every resource in internal/resources/ (except common.go) must have"
echo "a corresponding acceptance test in internal/provider/."
exit 1
fi
echo "All resources have acceptance tests. ✓"