Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .crystal-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.18.2
21 changes: 21 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Lucky env
LUCKY_ENV=development
PORT=3000

# DB connection for local dev
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_NAME=florex

# Optional: if you prefer a full URL:
# DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/florex

# For Lucky encryption/session
SECRET_KEY_BASE=

# pgsql
POSTGRES_USER=lucky
POSTGRES_PASSWORD=password
POSTGRES_DB=lucky
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: stem CI

on:
push:
branches: "*"
pull_request:
branches: "*"

jobs:
check-format:
strategy:
fail-fast: false
matrix:
crystal_version:
- 1.18.2
experimental:
- false
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal_version }}
- name: Format
run: crystal tool format --check

specs:
strategy:
fail-fast: false
matrix:
crystal_version:
- 1.18.2
experimental:
- false
runs-on: ubuntu-latest
env:
LUCKY_ENV: test
DB_HOST: localhost
continue-on-error: ${{ matrix.experimental }}
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal_version }}

- name: Set up Crystal cache
uses: actions/cache@v4
id: crystal-cache
with:
path: |
~/.cache/crystal
lib
key: ${{ runner.os }}-crystal-${{ hashFiles('**/shard.lock') }}
restore-keys: |
${{ runner.os }}-crystal-

- name: Install shards
if: steps.crystal-cache.outputs.cache-hit != 'true'
run: shards check || shards install

- name: Build lucky_tasks
run: crystal build tasks.cr -o ./lucky_tasks

- name: Prepare database
run: |
./lucky_tasks db.create
./lucky_tasks db.migrate
./lucky_tasks db.seed.required_data

- name: Run tests
run: crystal spec
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
/bin/
/.shards/
*.dwarf
.idea/
start_server
*.dwarf
*.local.cr
.env
/tmp
.idea
2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: bin/app
release: lucky db.migrate
2 changes: 2 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
system_check: crystal script/system_check.cr
web: lucky watch
Loading