Skip to content

Commit a2f9992

Browse files
authored
feat: fix action testing (#1758)
Co-authored-by: Ashish Padhy <[email protected]>
1 parent 1b62a66 commit a2f9992

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed

Diff for: .changeset/curly-cars-knock.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
"@fake-scope/fake-pkg": patch
2+
'@asyncapi/cli': patch
33
---
44

5-
Fixing script detection issue in version 3.0.0
5+
- Fixes script detection issue in version 3.0.0
6+
- Fixes testing by testing the github action with local CLI

Diff for: .github/workflows/test-action.yml

+18
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
docker load --input /tmp/asyncapi.tar
7676
docker image ls -a
7777
- uses: actions/checkout@v4
78+
- name: Remove bin directory to disable developer mode
79+
run: rm -rf ./bin
7880
- name: Test GitHub Action
7981
uses: ./
8082
with:
@@ -107,6 +109,8 @@ jobs:
107109
docker load --input /tmp/asyncapi.tar
108110
docker image ls -a
109111
- uses: actions/checkout@v4
112+
- name: Remove bin directory to disable developer mode
113+
run: rm -rf ./bin
110114
- name: Test GitHub Action
111115
uses: ./
112116
with:
@@ -128,6 +132,8 @@ jobs:
128132
docker load --input /tmp/asyncapi.tar
129133
docker image ls -a
130134
- uses: actions/checkout@v4
135+
- name: Remove bin directory to disable developer mode
136+
run: rm -rf ./bin
131137
- name: Test GitHub Action
132138
uses: ./
133139
with:
@@ -162,6 +168,8 @@ jobs:
162168
docker load --input /tmp/asyncapi.tar
163169
docker image ls -a
164170
- uses: actions/checkout@v4
171+
- name: Remove bin directory to disable developer mode
172+
run: rm -rf ./bin
165173
- name: Test GitHub Action
166174
uses: ./
167175
with:
@@ -195,6 +203,8 @@ jobs:
195203
docker load --input /tmp/asyncapi.tar
196204
docker image ls -a
197205
- uses: actions/checkout@v4
206+
- name: Remove bin directory to disable developer mode
207+
run: rm -rf ./bin
198208
- name: Test GitHub Action
199209
id: test
200210
uses: ./
@@ -225,6 +235,8 @@ jobs:
225235
docker load --input /tmp/asyncapi.tar
226236
docker image ls -a
227237
- uses: actions/checkout@v4
238+
- name: Remove bin directory to disable developer mode
239+
run: rm -rf ./bin
228240
- name: Test GitHub Action
229241
id: test
230242
uses: ./
@@ -257,6 +269,8 @@ jobs:
257269
docker load --input /tmp/asyncapi.tar
258270
docker image ls -a
259271
- uses: actions/checkout@v4
272+
- name: Remove bin directory to disable developer mode
273+
run: rm -rf ./bin
260274
- name: Test GitHub Action
261275
uses: ./
262276
with:
@@ -291,6 +305,8 @@ jobs:
291305
docker load --input /tmp/asyncapi.tar
292306
docker image ls -a
293307
- uses: actions/checkout@v4
308+
- name: Remove bin directory to disable developer mode
309+
run: rm -rf ./bin
294310
- name: Make output directory
295311
run: mkdir -p ./output/bundle
296312
- name: Test GitHub Action
@@ -325,6 +341,8 @@ jobs:
325341
docker load --input /tmp/asyncapi.tar
326342
docker image ls -a
327343
- uses: actions/checkout@v4
344+
- name: Remove bin directory to disable developer mode
345+
run: rm -rf ./bin
328346
- name: Test GitHub Action
329347
uses: ./
330348
with:

Diff for: github-action/entrypoint.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ PARAMETERS="$7"
2626
CUSTOM_COMMAND="$8"
2727

2828
echo "::group::Debug information"
29-
if [ -n "$CLI_VERSION" ] && [ ! "$CLI_VERSION" == "latest" ]; then
29+
# Check if currently running in Developer environment by checking for presence of ./bin/run or ../bin/run and set alias asyncapi= PATH_TO_BIN/RUN
30+
if [ -f "$workdir/bin/run" ]; then
31+
echo -e "${BLUE}Running in developer environment...${NC}"
32+
echo -e "${BLUE}Setting alias for asyncapi:${NC}" "$workdir/bin/run"
33+
shopt -s expand_aliases
34+
alias asyncapi="$workdir/bin/run"
35+
elif [ -f "$workdir/../bin/run" ]; then
36+
echo -e "${BLUE}Running in developer environment...${NC}"
37+
echo -e "${BLUE}Setting alias for asyncapi:${NC}" "$workdir/../bin/run"
38+
shopt -s expand_aliases
39+
alias asyncapi="$workdir/../bin/run"
40+
elif [ -n "$CLI_VERSION" ] && [ ! "$CLI_VERSION" == "latest" ]; then
3041
echo -e "${BLUE}CLI version:${NC}" "$CLI_VERSION"
3142
# Check if the CLI version is already installed or not
3243
if [ -z $(command -v -- asyncapi) ]; then

Diff for: package-lock.json

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
"createhook": "oclif generate hook myhook --event=command_not_found",
175175
"createhookinit": "oclif generate hook inithook --event=init",
176176
"action:docker:build": "docker build -f github-action/Dockerfile -t asyncapi/github-action-for-cli:latest .",
177-
"action:test": "cd github-action && make test"
177+
"action:test": "npm run build && cd github-action && make test"
178178
},
179179
"types": "lib/index.d.ts"
180180
}

0 commit comments

Comments
 (0)