Skip to content

feat: add health endpoint #19

feat: add health endpoint

feat: add health endpoint #19

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno
name: Deno
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
env:
# The MySQL docker container requires these environment variables to be set
# so we can create and migrate the test database.
# See: https://hub.docker.com/_/mysql
MYSQL_DATABASE: shopping
MYSQL_ROOT_PASSWORD: example
MYSQL_USER: moovup
MYSQL_PASSWORD: moovup
ports:
# Opens port 3306 on service container and host
# https://docs.github.com/en/actions/using-containerized-services/about-service-containers
- 3306:3306
# Before continuing, verify the mysql container is reachable from the ubuntu host
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
# Uncomment this step to verify the use of 'deno fmt' on each commit.
# - name: Verify formatting
# run: deno fmt --check
- name: Run linter
run: deno lint
- name: Create tables
run: mysql --protocol=tcp -h localhost -P 3306 -u root -pexample shopping < db_migration/init.sql
- name: Run tests
run: deno task test --env=.env.ci
env:
DB_HOST: localhost