Skip to content

Commit d46ea8e

Browse files
makefile updated tun run example file - so ci/cd can run
1 parent 3682795 commit d46ea8e

1 file changed

Lines changed: 192 additions & 0 deletions

File tree

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
name: SDK Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
unit-tests:
14+
name: Unit Tests
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.11"
25+
26+
- name: Install dependencies
27+
run: make dev-install
28+
29+
- name: Run format check
30+
run: make fmt-check
31+
32+
- name: Run lint
33+
run: make lint
34+
35+
- name: Run unit tests
36+
run: make type-check && .venv/bin/python -m pytest -v tests/
37+
38+
integration-tests:
39+
name: Integration Tests (Example Files)
40+
runs-on: ubuntu-latest
41+
needs: unit-tests # only runs if unit tests pass
42+
43+
env:
44+
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
45+
TFE_ORG: ${{ secrets.TFE_ORG }}
46+
TFE_ADDRESS: ${{ secrets.TFE_ADDRESS }}
47+
TFE_WORKSPACE_ID: ${{ secrets.TFE_WORKSPACE_ID }}
48+
TFE_WORKSPACE_NAME: ${{ secrets.TFE_WORKSPACE_NAME }}
49+
TFE_RUN_ID: ${{ secrets.TFE_RUN_ID }}
50+
TFE_APPLY_ID: ${{ secrets.TFE_APPLY_ID }}
51+
TFE_PLAN_ID: ${{ secrets.TFE_PLAN_ID }}
52+
TFE_TASK_STAGE_ID: ${{ secrets.TFE_TASK_STAGE_ID }}
53+
TFE_POLICY_SET_ID: ${{ secrets.TFE_POLICY_SET_ID }}
54+
TFE_POLICY_NAME: ${{ secrets.TFE_POLICY_NAME }}
55+
TFE_REG_PROV_NS: ${{ secrets.TFE_REG_PROV_NS }}
56+
TFE_REG_PROV_NAME: ${{ secrets.TFE_REG_PROV_NAME }}
57+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
58+
OAUTH_CLIENT_GITHUB_TOKEN: ${{ secrets.OAUTH_CLIENT_GITHUB_TOKEN }}
59+
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
60+
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v4
65+
66+
- name: Set up Python
67+
uses: actions/setup-python@v5
68+
with:
69+
python-version: "3.11"
70+
71+
- name: Install dependencies
72+
run: make dev-install
73+
74+
- name: agent.py
75+
run: .venv/bin/python examples/agent.py || true
76+
77+
- name: agent_pool.py
78+
run: .venv/bin/python examples/agent_pool.py || true
79+
80+
- name: apply.py
81+
if: ${{ env.TFE_APPLY_ID != '' }}
82+
run: .venv/bin/python examples/apply.py --apply-id "$TFE_APPLY_ID" || true
83+
84+
- name: configuration_version.py
85+
if: ${{ env.TFE_WORKSPACE_ID != '' }}
86+
run: .venv/bin/python examples/configuration_version.py || true
87+
88+
- name: notification_configuration.py
89+
if: ${{ env.TFE_WORKSPACE_ID != '' || env.TFE_WORKSPACE_NAME != '' }}
90+
run: .venv/bin/python examples/notification_configuration.py || true
91+
92+
- name: oauth_client.py
93+
run: .venv/bin/python examples/oauth_client.py || true
94+
95+
- name: oauth_token.py
96+
run: .venv/bin/python examples/oauth_token.py || true
97+
98+
- name: org.py
99+
run: .venv/bin/python examples/org.py || true
100+
101+
- name: organization_membership.py
102+
run: .venv/bin/python examples/organization_membership.py || true
103+
104+
- name: plan.py
105+
if: ${{ env.TFE_PLAN_ID != '' }}
106+
run: .venv/bin/python examples/plan.py --plan-id "$TFE_PLAN_ID" || true
107+
108+
- name: policy_check.py
109+
if: ${{ env.TFE_RUN_ID != '' }}
110+
run: .venv/bin/python examples/policy_check.py --run-id "$TFE_RUN_ID" || true
111+
112+
- name: policy_evaluation.py
113+
if: ${{ env.TFE_TASK_STAGE_ID != '' }}
114+
run: .venv/bin/python examples/policy_evaluation.py --task-stage-id "$TFE_TASK_STAGE_ID" || true
115+
116+
- name: policy_set_parameter.py
117+
if: ${{ env.TFE_POLICY_SET_ID != '' }}
118+
run: .venv/bin/python examples/policy_set_parameter.py --policy-set-id "$TFE_POLICY_SET_ID" || true
119+
120+
- name: policy_set.py
121+
run: .venv/bin/python examples/policy_set.py --org "$TFE_ORG" || true
122+
123+
- name: policy.py
124+
if: ${{ env.TFE_POLICY_NAME != '' }}
125+
run: .venv/bin/python examples/policy.py --org "$TFE_ORG" --policy-name "$TFE_POLICY_NAME" || true
126+
127+
- name: project.py
128+
run: .venv/bin/python examples/project.py --list --organization "$TFE_ORG" || true
129+
130+
- name: query_run.py
131+
if: ${{ env.TFE_WORKSPACE_NAME != '' }}
132+
run: .venv/bin/python examples/query_run.py || true
133+
134+
- name: registry_module.py
135+
run: .venv/bin/python examples/registry_module.py || true
136+
137+
- name: registry_provider_version.py
138+
if: ${{ env.TFE_REG_PROV_NS != '' && env.TFE_REG_PROV_NAME != '' }}
139+
run: |
140+
.venv/bin/python examples/registry_provider_version.py \
141+
--organization "$TFE_ORG" \
142+
--namespace "$TFE_REG_PROV_NS" \
143+
--name "$TFE_REG_PROV_NAME" || true
144+
145+
- name: registry_provider.py
146+
run: .venv/bin/python examples/registry_provider.py || true
147+
148+
- name: reserved_tag_key.py
149+
run: .venv/bin/python examples/reserved_tag_key.py || true
150+
151+
- name: run_events.py
152+
if: ${{ env.TFE_RUN_ID != '' }}
153+
run: .venv/bin/python examples/run_events.py --run-id "$TFE_RUN_ID" || true
154+
155+
- name: run_task.py
156+
run: .venv/bin/python examples/run_task.py --org "$TFE_ORG" || true
157+
158+
- name: run_trigger.py
159+
run: .venv/bin/python examples/run_trigger.py --org "$TFE_ORG" || true
160+
161+
- name: run.py
162+
run: .venv/bin/python examples/run.py --organization "$TFE_ORG" || true
163+
164+
- name: ssh_keys.py
165+
if: ${{ env.SSH_PRIVATE_KEY != '' }}
166+
run: .venv/bin/python examples/ssh_keys.py || true
167+
168+
- name: state_versions.py
169+
if: ${{ env.TFE_WORKSPACE_ID != '' && env.TFE_WORKSPACE_NAME != '' }}
170+
run: |
171+
.venv/bin/python examples/state_versions.py \
172+
--org "$TFE_ORG" \
173+
--workspace "$TFE_WORKSPACE_NAME" \
174+
--workspace-id "$TFE_WORKSPACE_ID" || true
175+
176+
- name: variable_sets.py
177+
run: .venv/bin/python examples/variable_sets.py || true
178+
179+
- name: variables.py
180+
if: ${{ env.TFE_WORKSPACE_ID != '' }}
181+
run: .venv/bin/python examples/variables.py || true
182+
183+
- name: workspace_resources.py
184+
if: ${{ env.TFE_WORKSPACE_ID != '' }}
185+
run: |
186+
.venv/bin/python examples/workspace_resources.py \
187+
--list \
188+
--workspace-id "$TFE_WORKSPACE_ID" \
189+
--page-size 10 || true
190+
191+
- name: workspace.py
192+
run: .venv/bin/python examples/workspace.py --org "$TFE_ORG" --list || true

0 commit comments

Comments
 (0)