create db #11
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: CI | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "*" | |
workflow_dispatch: | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
test-suite: | |
# runs-on: ubuntu-latest | |
runs-on: ubuntu-22.04 | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
# - name: Setup MySQL 8.0 | |
# if: matrix.db-type == 'mysql' | |
# run: | | |
# sudo service mysql start | |
# mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE gleam_cake;' | |
# - name: Setup PostgreSQL latest | |
# # if: matrix.db-type == 'pgsql' | |
# run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=gleam_cake -p 5432:5432 -d postgres | |
- uses: getong/mariadb-action@v1.1 | |
# if: matrix.db-type == 'mariadb' | |
with: | |
mysql database: "gleam_cake" | |
mysql root password: "root" | |
- uses: actions/checkout@v4 | |
- name: Get date part for cache key | |
id: key-date | |
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: "27.0" | |
gleam-version: "1.2.1" | |
rebar3-version: "3" | |
- name: Get Gleam deps | |
run: gleam deps download | |
- name: Wait for MariaDB and MySQL | |
# if: matrix.db-type == 'mysql' || matrix.db-type == 'mariadb' | |
run: while ! `mysqladmin ping -h 127.0.0.1 --silent`; do printf 'Waiting for MySQL...\n'; sleep 2; done; | |
- run: gleam build | |
- run: ./test/gleam-cake-postgres-db-reset.sh | |
env: | |
PGHOST: localhost | |
PGPORT: 5432 | |
PGPASSWORD: postgres | |
PGUSER: postgres | |
- name: Test suite | |
run: gleam test --target erlang | |
- name: Code format check | |
run: gleam format --check src test |