Skip to content

Commit

Permalink
updating to v4 and optimizing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jalajk3004 committed Dec 21, 2024
1 parent 3d67ddf commit 971bac6
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 48 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ jobs:
action_version=${BASH_REMATCH[1]};
echo "action_version=$action_version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Build Docker image and export
uses: docker/build-push-action@v5
with:
context: .
file: ./github-action/Dockerfile
tags: asyncapi/github-action-for-cli:${{ steps.docker_version.outputs.action_version }}
outputs: type=docker,dest=/tmp/asyncapi.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Cache Docker Image
uses: actions/cache@v3
with:
name: asyncapi
path: /tmp/asyncapi.tar
key: ${{ runner.os }}-asyncapi-cache


test-defaults:
Expand All @@ -66,10 +66,10 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
path: /tmp/asyncapi.tar
key: ${{ runner.os }}-asyncapi-cache
- name: Load Docker image
run: |
docker load --input /tmp/asyncapi.tar
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand All @@ -119,7 +119,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down Expand Up @@ -282,7 +282,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
needs: [should-workflow-run, build-docker]
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: asyncapi
path: /tmp
Expand Down
73 changes: 73 additions & 0 deletions github-action/test/unoptimized_optimized.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
asyncapi: 2.0.0
info:
title: Streetlights API
version: 1.0.0
channels:
smartylighting/event/{streetlightId}/lighting/measured:
$ref: >-
#/components/channels/smartylighting/event/{streetlightId}/lighting/measured
parameters:
streetlightId:
schema:
$ref: '#/components/schemas/schema'
smartylighting/action/{streetlightId}/turn/on:
$ref: '#/components/channels/smartylighting/action/{streetlightId}/turn/on'
components:
schemas:
sentAt:
type: string
format: date-time
lumens:
type: integer
minimum: 0
payload:
type: object
properties:
sentAt:
$ref: '#/components/schemas/sentAt'
messages:
message:
name: turnOnOff
title: Turn on/off
traits:
- headers:
type: object
properties:
my-app-header:
type: integer
minimum: 0
maximum: 100
payload:
$ref: '#/components/schemas/payload'
operations:
subscribe:
operationId: receiveLightMeasurement
traits:
- bindings:
kafka:
clientId: my-app-id
message:
$ref: '#/components/messages/message'
publish:
operationId: turnOn
traits:
- bindings:
kafka:
clientId: my-app-id
message:
$ref: '#/components/messages/message'
channels:
smartylighting/event/{streetlightId}/lighting/measured:
parameters:
streetlightId:
schema:
$ref: '#/components/schemas/schema'
subscribe:
$ref: '#/components/operations/subscribe'
smartylighting/action/{streetlightId}/turn/on:
parameters:
streetlightId:
schema:
$ref: '#/components/schemas/schema'
publish:
$ref: '#/components/operations/publish'
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 29 additions & 30 deletions test/fixtures/badFormatAsyncapi.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
{
"asyncapi": "2.2.0",
"info": {
"title": "Account Service",
"version": "1.0.0",
"description":
"This service is in charge of processing user signups"
},
"channels": {
"user/signedup": {
"subscribe": {
"message": {
"$ref": "#/components/messages/UserSignedUp"
}
"asyncapi": "2.2.0",
"info": {
"title": "Account Service",
"version": "1.0.0",
"description": "This service is in charge of processing user signups"
},
"channels": {
"user/signedup": {
"subscribe": {
"message": {
"$ref": "#/components/messages/UserSignedUp"
}
}
},
"components": {
"messages": {
"UserSignedUp": {
"payload": {
"type": "object",
"properties": {
"displayName": {
"type": "string",
"description": "Name of the user"
},
"email": {
"type": "string",
"format": "email",
"description": "Email of the user"
}
}
},
"components": {
"messages": {
"UserSignedUp": {
"payload": {
"type": "object",
"properties": {
"displayName": {
"type": "string",
"description": "Name of the user"
},
"email": {
"type": "string",
"format": "email",
"description": "Email of the user"
}
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion test/fixtures/newtemplate/__transpiled/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 971bac6

Please sign in to comment.