Skip to content

Commit a1d3c4c

Browse files
dylanratcliffeactions-user
authored andcommitted
Example change for copybara testing
GitOrigin-RevId: b2928a634996d7fa94da2eb6fe03b9a7ba3a8402
1 parent 8fa6c5b commit a1d3c4c

File tree

5 files changed

+251
-24
lines changed

5 files changed

+251
-24
lines changed

.github/workflows/e2e.yaml

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
name: E2E Tests
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
# this tests the basic commands without checking the output
9+
actions:
10+
runs-on: depot-ubuntu-22.04-4
11+
env:
12+
CGO_ENABLED: 0
13+
permissions:
14+
contents: read # required for checkout
15+
id-token: write # mint AWS credentials through OIDC
16+
17+
steps:
18+
- name: Cache Terraform Providers
19+
id: cache-terraform
20+
uses: actions/cache@v4
21+
with:
22+
path: .terraform
23+
key: ${{ runner.os }}-${{ inputs.environment }}-${{ hashFiles('**/.terraform.lock.hcl') }}
24+
25+
- uses: hashicorp/setup-terraform@v3
26+
with:
27+
terraform_version: 1.5.7
28+
terraform_wrapper: false
29+
30+
- name: Configure AWS Credentials
31+
uses: aws-actions/configure-aws-credentials@v4
32+
with:
33+
audience: sts.amazonaws.com # set default value to work around https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-1401481855
34+
aws-region: eu-west-2
35+
role-to-assume: arn:aws:iam::211125377101:role/terraform-ci-test
36+
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
42+
- name: Set up Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: 1.x
46+
check-latest: true
47+
cache: true
48+
49+
- name: Build the binary
50+
run: |
51+
set -xe
52+
go get -v -t -d ./...
53+
go build -o overmind main.go
54+
55+
- name: Run E2E Tests
56+
env:
57+
OVM_API_KEY: ${{ secrets.OVM_API_KEY }}
58+
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }}
59+
run: |
60+
set -xe
61+
62+
./overmind -v
63+
64+
terraform init
65+
terraform plan -out=tfplan
66+
terraform show -json tfplan > tfplan.json
67+
68+
ticket_link='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
69+
70+
./overmind changes submit-plan \
71+
--title "Test Change for e2e tests" \
72+
--description "some description" \
73+
--ticket-link "$ticket_link" \
74+
tfplan.json \
75+
> ./overmindtech-change-url
76+
77+
# we only want the last line of the previous command
78+
./overmind changes get-change \
79+
--change "$(tail -n 1 ./overmindtech-change-url)" \
80+
--format markdown \
81+
> ./overmindtech-message
82+
83+
./overmind changes start-change \
84+
--ticket-link "$ticket_link"
85+
86+
./overmind changes end-change \
87+
--ticket-link "$ticket_link"
88+
89+
echo "E2E Tests Complete"
90+
91+
# this runs 2 commands that require user input,
92+
# the `overmind terraform plan` subcommand has to be run first and succeed before the `overmind terraform apply` subcommand can be run
93+
# the lost pixel tapes have built in sleeps to wait for commands to complete
94+
interactive:
95+
runs-on: depot-ubuntu-22.04-4
96+
env:
97+
CGO_ENABLED: 0
98+
permissions:
99+
contents: read # required for checkout
100+
id-token: write # mint AWS credentials through OIDC
101+
102+
steps:
103+
- name: Cache Terraform Providers
104+
id: cache-terraform
105+
uses: actions/cache@v4
106+
with:
107+
path: .terraform
108+
key: ${{ runner.os }}-${{ inputs.environment }}-${{ hashFiles('**/.terraform.lock.hcl') }}
109+
110+
- uses: hashicorp/setup-terraform@v3
111+
with:
112+
terraform_version: 1.5.7
113+
terraform_wrapper: false
114+
115+
- name: Configure AWS Credentials
116+
uses: aws-actions/configure-aws-credentials@v4
117+
with:
118+
audience: sts.amazonaws.com # set default value to work around https://github.com/aws-actions/configure-aws-credentials/issues/271#issuecomment-1401481855
119+
aws-region: eu-west-2
120+
role-to-assume: arn:aws:iam::211125377101:role/terraform-ci-test
121+
122+
- name: Checkout
123+
uses: actions/checkout@v4
124+
with:
125+
fetch-depth: 0
126+
127+
- name: Set up Go
128+
uses: actions/setup-go@v5
129+
with:
130+
go-version: 1.x
131+
check-latest: true
132+
cache: true
133+
134+
- name: Build the binary
135+
run: |
136+
set -xe
137+
go get -v -t -d ./...
138+
go build -o overmind main.go
139+
140+
- name: Run E2E Tests
141+
env:
142+
OVM_API_KEY: ${{ secrets.OVM_API_KEY }}
143+
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }}
144+
TEABUG: pls
145+
run: |
146+
set -xe
147+
148+
go build -o overmind main.go
149+
150+
./overmind -v
151+
152+
terraform init
153+
154+
cp -a $(which terraform) . # provide a terraform binary to the containers below
155+
# see the workflow file for an explanation of what is happening here
156+
docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_SESSION_TOKEN -e HONEYCOMB_API_KEY -e OVM_API_KEY -e TEABUG -v $PWD:/vhs -v ~/.aws:/root/.aws ghcr.io/charmbracelet/vhs /vhs/.github/e2eplan.tape
157+
docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_SESSION_TOKEN -e HONEYCOMB_API_KEY -e OVM_API_KEY -e TEABUG -v $PWD:/vhs -v ~/.aws:/root/.aws ghcr.io/charmbracelet/vhs /vhs/.github/e2eapply.tape
158+
159+
sudo chown --recursive $(whoami) .
160+
161+
terraform apply -destroy -auto-approve
162+
163+
echo "E2E Tests Complete"
164+
165+
- name: debug output
166+
if: always()
167+
run: |
168+
cat teabug.log
169+
170+
- name: Upload plan results
171+
if: always()
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: plan.mp4
175+
path: e2e/plan.*
176+
177+
- name: Upload apply results
178+
if: always()
179+
uses: actions/upload-artifact@v4
180+
with:
181+
name: apply.mp4
182+
path: e2e/apply.*
183+
184+
- name: Setup Node.js
185+
uses: actions/setup-node@v4
186+
with:
187+
node-version: 22
188+
189+
- name: Install pnpm
190+
uses: pnpm/action-setup@v3
191+
id: pnpm-install
192+
with:
193+
version: 9
194+
run_install: false
195+
196+
- name: Get pnpm store directory
197+
id: pnpm-cache
198+
shell: bash
199+
run: |
200+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
201+
202+
- name: Setup pnpm cache
203+
uses: actions/cache@v4
204+
with:
205+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
206+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
207+
restore-keys: |
208+
${{ runner.os }}-pnpm-store-
209+
210+
- name: Install dependencies
211+
run: pnpm install
212+
continue-on-error: false
213+
214+
- name: Lost Pixel
215+
uses: lost-pixel/[email protected]
216+
env:
217+
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}

.github/workflows/release.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,10 @@ on:
55
tags:
66
- 'v*'
77
jobs:
8-
test:
9-
name: Run Tests
10-
runs-on: depot-ubuntu-22.04-4
11-
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
with:
16-
fetch-depth: 0
17-
18-
- name: Set up Go
19-
uses: actions/setup-go@v5
20-
with:
21-
go-version: 1.x
22-
check-latest: true
23-
cache: true
24-
25-
- name: Go Test
26-
run: |
27-
go run main.go --version
28-
go test -race -v -timeout 5m github.com/overmindtech/cli github.com/overmindtech/cli/tfutils
29-
308
# Actually release the binaries including signing them
319
release:
3210
runs-on: depot-ubuntu-22.04-32
3311
if: ${{ github.event_name != 'pull_request' }}
34-
needs: test
3512
permissions:
3613
contents: write
3714
packages: write

.github/workflows/test_release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: goreleaser-dry-run
2+
3+
on:
4+
pull_request:
5+
jobs:
6+
dry-run:
7+
runs-on: depot-ubuntu-22.04-8
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: 1.x
22+
check-latest: true
23+
cache: true
24+
25+
- name: Run GoReleaser (dry run)
26+
uses: goreleaser/goreleaser-action@v6
27+
with:
28+
version: latest
29+
args: release --clean --snapshot --skip publish,sign
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ jobs:
44
test:
55
name: Run Tests
66
runs-on: depot-ubuntu-22.04-4
7+
env:
8+
CGO_ENABLED: 0
79

810
steps:
911
- name: Checkout

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,4 @@ Please look in the [CONTRIBUTING.md](https://github.com/overmindtech/cli/blob/ma
268268

269269
See the [LICENSE](/LICENSE) file for licensing information.
270270

271-
Overmind is made with ❤️ in 🇺🇸🇬🇧🇦🇹🇫🇷🇷🇴
271+
Overmind is made with ❤️ in 🇺🇸🇬🇧🇦🇹🇫🇷🇷🇴

0 commit comments

Comments
 (0)