Skip to content

Add GitHub action to run tests on every commit to main and pull requests #16

Add GitHub action to run tests on every commit to main and pull requests

Add GitHub action to run tests on every commit to main and pull requests #16

Workflow file for this run

name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
dynamodb:
image: amazon/dynamodb-local
ports:
- 8000:8000
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Create DynamoDB table
env:
AWS_ACCESS_KEY_ID: DUMMYIDEXAMPLE
AWS_SECRET_ACCESS_KEY: DUMMYEXAMPLEKEY
AWS_SESSION_TOKEN: dummy
run: |
./docker/wait-for-db.sh
aws dynamodb create-table \
--region eu-west-1 \
--table-name clients \
--attribute-definitions AttributeName=clientId,AttributeType=S \
--key-schema AttributeName=clientId,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \
--endpoint-url http://localhost:8000 \
--no-cli-pager
- name: Run tests
env:
AWS_ACCESS_KEY_ID: DUMMYIDEXAMPLE
AWS_SECRET_ACCESS_KEY: DUMMYEXAMPLEKEY
AWS_SESSION_TOKEN: dummy
run: task test