-
Notifications
You must be signed in to change notification settings - Fork 75
171 lines (166 loc) · 5.51 KB
/
Copy pathrun-acceptance-tests.yaml
File metadata and controls
171 lines (166 loc) · 5.51 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
permissions: write-all # Equivalent to default permissions plus id-token: write
name: Pulumi Kubernetes Operator PR Builds
on:
repository_dispatch:
types: [run-acceptance-tests-command]
push:
branches:
- master
pull_request:
branches:
- master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: v0.0-${{ github.sha }}
ESC_ACTION_OIDC_AUTH: true
ESC_ACTION_OIDC_ORGANIZATION: pulumi
ESC_ACTION_OIDC_REQUESTED_TOKEN_TYPE: urn:pulumi:token-type:access_token:organization
ESC_ACTION_ENVIRONMENT: github-secrets/pulumi-pulumi-kubernetes-operator
ESC_ACTION_EXPORT_ENVIRONMENT_VARIABLES: PULUMI_ACCESS_TOKEN,PULUMI_BOT_TOKEN
jobs:
comment-notification:
runs-on: ubuntu-latest
name: comment-notification
if: github.event_name == 'repository_dispatch'
steps:
- name: Create URL to the run output
id: vars
run: echo
run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
>> "$GITHUB_OUTPUT"
- name: Update with Result
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
token: ${{ secrets.PULUMI_BOT_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
body: "Please view the PR build: ${{ steps.vars.outputs.run-url }}"
build:
runs-on: ubuntu-latest
name: Build
if: github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Fetch secrets from ESC
id: esc-secrets
uses: pulumi/esc-action@32dda43ffe7a2ab21e6bce11c781b44a3e5623cf # v3
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ steps.esc-secrets.outputs.DOCKER_USERNAME }}
password: ${{ steps.esc-secrets.outputs.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
with:
push: false
load: true
platforms: linux/amd64
tags: |
pulumi/pulumi-kubernetes-operator:${{ env.VERSION }}
build-args: |
VERSION=${{ env.VERSION }}
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Fetch secrets from ESC
id: esc-secrets
uses: pulumi/esc-action@32dda43ffe7a2ab21e6bce11c781b44a3e5623cf # v3
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Lint pulumi-kubernetes-operator codebase
run: make lint
codegen:
runs-on: ubuntu-latest
name: Codegen freshness
steps:
- name: Fetch secrets from ESC
id: esc-secrets
uses: pulumi/esc-action@32dda43ffe7a2ab21e6bce11c781b44a3e5623cf # v3
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Verify generated CRDs and docs are up to date
run: |
make codegen
if ! git diff --exit-code; then
echo "::error::Generated CRDs/docs are stale. Run 'make codegen' and commit the result."
exit 1
fi
unit-tests:
runs-on: ubuntu-latest
name: Unit tests
if: github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Fetch secrets from ESC
id: esc-secrets
uses: pulumi/esc-action@32dda43ffe7a2ab21e6bce11c781b44a3e5623cf # v3
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install Pulumi CLI
uses: pulumi/actions@8e5e406f4007fca908480587cb9893c07090f58d # v7.0.0
with:
pulumi-version-file: .pulumi.version
- name: Run Tests (Agent)
run: make -C agent test
- name: Run Tests (Operator)
run: make -C operator test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: agent/coverage.out,operator/coverage.out
env:
CODECOV_TOKEN: ${{ steps.esc-secrets.outputs.CODECOV_TOKEN }}
e2e-tests:
runs-on: pulumi-ubuntu-8core
name: E2E tests
if: github.event_name == 'repository_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Fetch secrets from ESC
id: esc-secrets
uses: pulumi/esc-action@32dda43ffe7a2ab21e6bce11c781b44a3e5623cf # v3
- name: Setup cluster
uses: helm/kind-action@v1
with:
cluster_name: kind
node_image: kindest/node:v1.31.0
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run tests
run: make -C operator test-e2e