-
Notifications
You must be signed in to change notification settings - Fork 16
132 lines (128 loc) · 4.33 KB
/
test-composite-action.yml
File metadata and controls
132 lines (128 loc) · 4.33 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
name: Test Composite Action
on:
pull_request:
workflow_dispatch:
jobs:
test-run-workflow-pr-mode:
name: "Test: run-workflow (PR mode)"
runs-on: ubuntu-latest
steps:
- name: Checkout test SDK repo
uses: actions/checkout@v4
with:
repository: speakeasy-api/sdk-generation-action-test-repo
token: ${{ secrets.BOT_REPO_TOKEN }}
fetch-depth: 0
- name: Checkout action
uses: actions/checkout@v4
with:
path: _action
- name: Run action in PR mode
id: run
uses: ./_action/
with:
github_access_token: ${{ secrets.BOT_REPO_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
action: run-workflow
mode: pr
force: "true"
- name: Verify outputs
run: |
echo "=== Verifying run-workflow (PR mode) outputs ==="
echo "branch_name=${{ steps.run.outputs.branch_name }}"
echo "go_regenerated=${{ steps.run.outputs.go_regenerated }}"
echo "go_directory=${{ steps.run.outputs.go_directory }}"
if [ "${{ steps.run.outputs.go_regenerated }}" = "true" ]; then
echo "PASS: Go SDK was regenerated"
else
echo "FAIL: Go SDK was not regenerated"
exit 1
fi
echo "=== PR mode test complete ==="
test-run-workflow-direct-mode:
name: "Test: run-workflow (direct mode)"
runs-on: ubuntu-latest
steps:
- name: Checkout test SDK repo
uses: actions/checkout@v4
with:
repository: speakeasy-api/sdk-generation-action-test-repo
token: ${{ secrets.BOT_REPO_TOKEN }}
fetch-depth: 0
- name: Checkout action
uses: actions/checkout@v4
with:
path: _action
- name: Run action in direct mode
id: run
uses: ./_action/
with:
github_access_token: ${{ secrets.BOT_REPO_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
action: run-workflow
mode: direct
force: "true"
- name: Verify outputs
run: |
echo "=== Verifying run-workflow (direct mode) outputs ==="
echo "commit_hash=${{ steps.run.outputs.commit_hash }}"
echo "go_regenerated=${{ steps.run.outputs.go_regenerated }}"
echo "go_directory=${{ steps.run.outputs.go_directory }}"
if [ "${{ steps.run.outputs.go_regenerated }}" = "true" ]; then
echo "PASS: Go SDK was regenerated"
else
echo "FAIL: Go SDK was not regenerated"
exit 1
fi
echo "=== Direct mode test complete ==="
test-release:
name: "Test: release"
runs-on: ubuntu-latest
needs: [test-run-workflow-direct-mode]
steps:
- name: Checkout test SDK repo
uses: actions/checkout@v4
with:
repository: speakeasy-api/sdk-generation-action-test-repo
token: ${{ secrets.BOT_REPO_TOKEN }}
fetch-depth: 0
- name: Checkout action
uses: actions/checkout@v4
with:
path: _action
- name: Run action in release mode
id: run
uses: ./_action/
with:
github_access_token: ${{ secrets.BOT_REPO_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
action: release
- name: Verify release outputs
run: |
echo "=== Verifying release outputs ==="
echo "publish_go=${{ steps.run.outputs.publish_go }}"
echo "go_regenerated=${{ steps.run.outputs.go_regenerated }}"
echo "=== Release test complete ==="
test-tag:
name: "Test: tag"
runs-on: ubuntu-latest
steps:
- name: Checkout test SDK repo
uses: actions/checkout@v4
with:
repository: speakeasy-api/sdk-generation-action-test-repo
token: ${{ secrets.BOT_REPO_TOKEN }}
fetch-depth: 0
- name: Checkout action
uses: actions/checkout@v4
with:
path: _action
- name: Run action in tag mode
id: run
uses: ./_action/
with:
github_access_token: ${{ secrets.BOT_REPO_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
action: tag
- name: Verify tag completed
run: echo "=== Tag action completed successfully ==="