Add GitHub action to run tests on every commit to main and pull requests #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Run docker-compose | |
run: docker compose -f docker/docker-compose.yml up -d | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
with: | |
version: 3.x | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create DynamoDB table | |
run: | | |
export AWS_ACCESS_KEY_ID="DUMMYIDEXAMPLE" | |
export AWS_SECRET_ACCESS_KEY="DUMMYEXAMPLEKEY" | |
export AWS_SESSION_TOKEN="dummy" | |
./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 | |
run: task test |