DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • A Concise Guide to DevSecOps and Their Importance in CI/CD Pipeline
  • 7 Reasons Why Companies Should Apply DevOps and CI/CD Practices to Their Data Pipelines
  • The Role of CI/CD Pipeline in Software Development
  • Top DevOps Career Opportunities in 2022

Trending

  • How to Convert XLS to XLSX in Java
  • Unlocking AI Coding Assistants: Generate Unit Tests
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  • Measuring the Impact of AI on Software Engineering Productivity
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Pipeline of an Alexa Skill with GitHub Actions

Pipeline of an Alexa Skill with GitHub Actions

In this article, we discuss how to implement a Devops pipeline for your Alexa Skill using GitHub Actions.

By 
Xavier Portilla Edo user avatar
Xavier Portilla Edo
DZone Core CORE ·
Sep. 21, 20 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
6.7K Views

Join the DZone community and get the full member experience.

Join For Free

As we saw in the previous post, we have developed an entire pipeline for an Alexa Skill using CircleCI. Now we are going to build the same, but using the new continuous integration tool provided by GitHub, GitHub Actions in order to understand how it works and see the differences compared to the previous CI/CD platform used.

In turn, we are going to use the ASK CLI v2 and we will also use the file structure from an Alexa Skill provided by this new second version.

Prerequisites

Here are the technologies used in this project:

  1. Amazon Developer Account - How to create an account
  2. AWS Account - Sign up here for free
  3. ASK CLI - Install and configure ASK CLI
  4. GitHub Account - Sign up here for free
  5. Visual Studio Code

The Alexa Skills Kit Command Line Interface (ASK CLI) is a tool for us to manage our Alexa Skills and its related resources, such as AWS Lambda functions. With the ASK CLI, we have access to the Skill Management API, which allows us to manage Alexa Skills through the command line.

If you want to create a skill with ASK CLI v2, follow the steps described in the official Amazon Alexa documentation.

We are going to use this tool to perform some steps in our pipeline.

Let’s DevOps!

GitHub Actions

Github actions

GitHub Actions helps us to automate tasks within the software development lifecycle. GitHub Actions is event-driven, which means that we can run a series of commands after a specific event has occurred. For example, whenever someone creates a pull request for a repository, we can automatically run a pipeline on GitHub Actions.

An event automatically triggers the workflow, which contains one or more jobs. Then the jobs use steps to control the order in which the actions are executed. These actions are the commands that automate certain processes.

Pipeline

pipeline

We are going to explain job by job what is happening in our pipeline. First, the workflow jobs will be defined under the jobs node in the GitHub Actions configuration file:

Checkout

The checkout job will perform the following tasks:

  1. Code checkout.
  2. Give execution permission to run all tests
YAML
 




x
11


 
1
  checkout:
2
    runs-on: ubuntu-latest
3
    name: Checkout
4
    steps:
5
      # To use this repository's private action,
6
      # you must check out the repository
7
      - name: Checkout
8
        uses: actions/checkout@v2
9
      - run: |
10
          chmod +x -R ./test;
11
          ls -la


Build

The build job will perform the following tasks:

  1. Code checkout.
  2. Run npm install to download all Node.js dependencies
YAML
 




x
13


 
1
  build:
2
    runs-on: ubuntu-latest
3
    name: Build
4
    needs: checkout
5
    steps:
6
      # To use this repository's private action,
7
      # you must check out the repository
8
    - name: Checkout
9
      uses: actions/checkout@v2
10
    - run: |
11
        cd lambda;
12
        npm install
13

          


Pretests

The pretest job runs the quality check of the static code. See the full explanation here.

Test

The test job runs the unit tests. See the full explanation here.

Code Coverage

The codecov job will run the code coverage report. See the full explanation here.

Deploy

The deploy job will deploy the Alexa skill to the Alexa cloud in the development stage. See the full explanation here.

Testing the Voice User Interface

These jobs will verify our interaction model. See the full explanation here.

Integration tests

These jobs will check the interaction model and our backend as well. See the full explanation here.

End to End Tests

Bespoken

These jobs verify the entire system using voice as input thanks to Bespoken. See the full explanation here.

Validation Tests

These jobs will validate the Alexa Skill before submitting it for certification. See the full explanation here.

Store-artifacts

The store-artifacts job will perform the following tasks:

  1. Download the code.
  2. Store the code of our Alexa Skill as an artifact. It will be accessible on GitHub Actions whenever we want to see it.
YAML
 




x
14


 
1
  store-artifacts:
2
    runs-on: ubuntu-latest
3
    name: Submit
4
    needs: submit
5
    steps:
6
    # To use this repository's private action,
7
    # you must check out the repository
8
    - name: Checkout
9
      uses: actions/checkout@v2}
10
    - name: Upload code
11
      uses: actions/upload-artifact@v2
12
      with:
13
        name: code
14
        path: ${{ github.workspace }}


Submit

These jobs will send the Alexa Skill for certification. See the full explanation here.

Workflow

At the end of the GitHub Actions configuration file, we will define our pipeline as a GitHub Actions workflow that will execute the jobs explained above:

YAML
 




x
301


 
1

          
2

          
3
on: [push]
4

          
5
jobs:
6
  checkout:
7
    runs-on: ubuntu-latest
8
    name: Checkout
9
    steps:
10
      # To use this repository's private action,
11
      # you must check out the repository
12
      - name: Checkout
13
        uses: actions/checkout@v2
14
      - run: |
15
          chmod +x -R ./test;
16
          ls -la
17

          
18
  build:
19
    runs-on: ubuntu-latest
20
    name: Build
21
    needs: checkout
22
    steps:
23
      # To use this repository's private action,
24
      # you must check out the repository
25
    - name: Checkout
26
      uses: actions/checkout@v2
27
    - run: |
28
        cd lambda;
29
        npm install
30

          
31
  pretest:
32
    runs-on: ubuntu-latest
33
    name: Pre-test
34
    needs: build
35
    steps:
36
    # To use this repository's private action,
37
    # you must check out the repository
38
      # To use this repository's private action,
39
      # you must check out the repository
40
    - name: Checkout
41
      uses: actions/checkout@v2
42
    - run: |
43
        cd lambda;
44
        npm install;
45
        npm run lint;
46
        npm run lint-html
47
    - name: Upload results
48
      uses: actions/upload-artifact@v2
49
      with:
50
        name: eslint-report
51
        path: lambda/reports/eslint/
52

          
53
  test:
54
    runs-on: ubuntu-latest
55
    name: Test
56
    needs: pretest
57
    steps:
58
    # To use this repository's private action,
59
    # you must check out the repository
60
    - name: Checkout
61
      uses: actions/checkout@v2
62
    - run: |
63
        cd lambda;
64
        npm install;
65
        npm run test
66
    - name: Upload results
67
      uses: actions/upload-artifact@v2
68
      with:
69
        name: unit-tests-report-html
70
        path: lambda/mochawesome-report/
71
    - name: Upload results
72
      uses: actions/upload-artifact@v2
73
      with:
74
        name: unit-tests-report-xml
75
        path: lambda/reports/mocha/
76
    
77
  codecov:
78
    runs-on: ubuntu-latest
79
    name: Code Coverage
80
    needs: test
81
    steps:
82
    # To use this repository's private action,
83
    # you must check out the repository
84
    - name: Checkout
85
      uses: actions/checkout@v2
86
    - run: |
87
        cd lambda;
88
        npm install;
89
        npm run codecov
90
      env: # Or as an environment variable
91
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
92

          
93
  deploy:
94
    runs-on: ubuntu-latest
95
    name: Deploy
96
    needs: codecov
97
    steps:
98
    # To use this repository's private action,
99
    # you must check out the repository
100
    - name: Checkout
101
      uses: actions/checkout@v2
102
    - run: |
103
        sudo npm install -g ask-cli;
104
        sudo apt-get install -y jq
105
        cd lambda;
106
        npm install;
107
        npm run copy-package;
108
        cd src;
109
        npm run build-production
110
    - run: ls -la && ask deploy --ignore-hash  
111
      env: # Or as an environment variable
112
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
113
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
114
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
115
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
116
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
117
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
118
        SKILL_ID: ${{ secrets.SKILL_ID }}
119

          
120
  check-utterance-conflicts:
121
    runs-on: ubuntu-latest
122
    name: Check Utterance Conflicts
123
    needs: deploy
124
    steps:
125
    # To use this repository's private action,
126
    # you must check out the repository
127
    - name: Checkout
128
      uses: actions/checkout@v2
129
    - run: |
130
        sudo npm install -g ask-cli;
131
        chmod +x -R ./test;
132
        cd test/vui-test/;
133
        ./interaction_model_checker.sh $SKILL_ID v2
134
      env: # Or as an environment variable
135
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
136
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
137
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
138
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
139
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
140
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
141
        SKILL_ID: ${{ secrets.SKILL_ID }}
142

          
143
  check-utterance-resolution:
144
    runs-on: ubuntu-latest
145
    name: Check Utterance Resolution
146
    needs: deploy
147
    steps:
148
    # To use this repository's private action,
149
    # you must check out the repository
150
    - name: Checkout
151
      uses: actions/checkout@v2
152
    - run: |
153
        sudo npm install -g ask-cli;
154
        chmod +x -R ./test;
155
        cd test/vui-test/;
156
        ./utterance_resolution_checker.sh $SKILL_ID v2
157
      env: # Or as an environment variable
158
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
159
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
160
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
161
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
162
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
163
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
164
        SKILL_ID: ${{ secrets.SKILL_ID }}
165

          
166
  check-utterance-evaluation:
167
    runs-on: ubuntu-latest
168
    name: Check Utterance Evaluation
169
    needs: deploy
170
    steps:
171
    # To use this repository's private action,
172
    # you must check out the repository
173
    - name: Checkout
174
      uses: actions/checkout@v2
175
    - run: |
176
        sudo npm install -g ask-cli;
177
        chmod +x -R ./test;
178
        cd test/vui-test/;
179
        ./utterance_evaluation_checker.sh $SKILL_ID v2
180
      env: # Or as an environment variable
181
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
182
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
183
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
184
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
185
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
186
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
187
        SKILL_ID: ${{ secrets.SKILL_ID }}
188

          
189
  integration-test:
190
    runs-on: ubuntu-latest
191
    name: Integration test
192
    needs: check-utterance-evaluation
193
    steps:
194
    # To use this repository's private action,
195
    # you must check out the repository
196
    - name: Checkout
197
      uses: actions/checkout@v2
198
    - run: |
199
        sudo npm install -g ask-cli;
200
        chmod +x -R ./test;
201
        sudo apt-get install -y expect
202
        cd test/integration-test/;
203
        ./simple-dialog-checker.sh $SKILL_ID
204
      env: # Or as an environment variable
205
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
206
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
207
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
208
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
209
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
210
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
211
        SKILL_ID: ${{ secrets.SKILL_ID }}
212

          
213
  end-to-test:
214
    runs-on: ubuntu-latest
215
    name: End-to-end test
216
    needs: integration-test
217
    steps:
218
    # To use this repository's private action,
219
    # you must check out the repository
220
    - name: Checkout
221
      uses: actions/checkout@v2
222
    - run: |
223
        sudo npm install -g ask-cli;
224
        sudo npm install -g bespoken-tools;
225
        chmod +x -R ./test;
226
        bst test --config test/e2e-bespoken-test/testing.json
227
      env: # Or as an environment variable
228
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
229
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
230
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
231
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
232
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
233
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
234
        SKILL_ID: ${{ secrets.SKILL_ID }}
235
    - name: Upload code
236
      uses: actions/upload-artifact@v2
237
      with:
238
        name: bespoken-report
239
        path: test_output/
240
  
241
  validation-test:
242
    runs-on: ubuntu-latest
243
    name: Validation test
244
    needs: end-to-test
245
    steps:
246
    # To use this repository's private action,
247
    # you must check out the repository
248
    - name: Checkout
249
      uses: actions/checkout@v2
250
    - run: |
251
        sudo npm install -g ask-cli;
252
        chmod +x -R ./test;
253
        cd test/validation-test/;
254
        ./skill_validation_checker.sh $SKILL_ID v2
255
      env: # Or as an environment variable
256
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
257
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
258
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
259
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
260
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
261
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
262
        SKILL_ID: ${{ secrets.SKILL_ID }}
263
    
264
  submit:
265
    runs-on: ubuntu-latest
266
    name: Submit
267
    needs: validation-test
268
    steps:
269
    # To use this repository's private action,
270
    # you must check out the repository
271
    - name: Checkout
272
      uses: actions/checkout@v2
273
    - run: |
274
        sudo npm install -g ask-cli;
275
        chmod +x -R ./test;
276
        cd test/submit/;
277
        ./submit.sh $SKILL_ID v2
278
      env: # Or as an environment variable
279
        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
280
        ASK_ACCESS_TOKEN: ${{ secrets.ASK_ACCESS_TOKEN }}
281
        ASK_REFRESH_TOKEN: ${{ secrets.ASK_REFRESH_TOKEN }}
282
        ASK_VENDOR_ID: ${{ secrets.ASK_VENDOR_ID }}
283
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
284
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
285
        SKILL_ID: ${{ secrets.SKILL_ID }}
286

          
287
  store-artifacts:
288
    runs-on: ubuntu-latest
289
    name: Store Artifacts
290
    needs: submit
291
    steps:
292
    # To use this repository's private action,
293
    # you must check out the repository
294
    - name: Checkout
295
      uses: actions/checkout@v2
296
    - name: Upload code
297
      uses: actions/upload-artifact@v2
298
      with:
299
        name: code
300
        path: ${{ github.workspace }}
301

          


The GitHub Actions configuration file is located at .github/workflows/main.yml.

Resources

  • DevOps Wikipedia - Wikipedia
  • Node.js SDK Official Documentation - Node.js SDK Official Documentation
  • Official documentation of the Alexa Skills Kit - Official documentation of the Alexa Skills Kit
  • Official GitHub Actions documentation - Official GitHub Actions documentation

Conclusion

Having developed the same pipeline in CircleCI as you can read in this post, we can write down the following conclusions based on the problems we have encountered during the development of this project:

  1. GitHub Actions is a very young platform (it is barely a year and a half old).
  2. We can find basic functionality for any DevOps pipeline (control flows, manual approval steps, etc.) that is not yet available in GitHub Actions.
  3. Executing commands in a specific Docker container is only possible through the Actions available in its [marketplace] (https://github.com/marketplace). Because of this, it somewhat complicates working with Docker executors on this platform.

You can find the code on my GitHub.

That’s it!

I hope you find it useful! If you have any doubts or questions, feel free to contact me or post a comment below.

Happy coding!

Feel free to join to the Voice Devs Community by clicking here.

GitHub Pipeline (software) Command-line interface career Continuous Integration/Deployment Software development code style

Opinions expressed by DZone contributors are their own.

Related

  • A Concise Guide to DevSecOps and Their Importance in CI/CD Pipeline
  • 7 Reasons Why Companies Should Apply DevOps and CI/CD Practices to Their Data Pipelines
  • The Role of CI/CD Pipeline in Software Development
  • Top DevOps Career Opportunities in 2022

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: