Skip to content

Update crystal and pg versions in CI #443

Update crystal and pg versions in CI

Update crystal and pg versions in CI #443

Workflow file for this run

name: CI
on:
pull_request:
branches: "*"
push:
branches: master
schedule:
- cron: "0 7 * * 1"
jobs:
lint:
strategy:
matrix:
include:
- DB: mysql
- DB: postgres
runs-on: ubuntu-24.04
env:
DB: ${{ matrix.DB }}
steps:
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: latest
- name: Donwload sources
uses: actions/checkout@v4
- name: Check formatting
if: ${{ matrix.linter }}
run: make format
- name: Install dependencies
run: shards install
- name: Run linter
if: ${{ matrix.linter }}
run: make lint
test:
needs: lint
strategy:
fail-fast: false
matrix:
include:
- crystal_version: 1.0.0
DB: mysql
os: ubuntu-20.04
- crystal_version: 1.0.0
DB: postgres
os: ubuntu-20.04
- crystal_version: 1.1.0
DB: mysql
os: ubuntu-20.04
- crystal_version: 1.1.0
DB: postgres
os: ubuntu-20.04
- crystal_version: 1.2.2
DB: mysql
- crystal_version: 1.2.2
DB: postgres
- crystal_version: 1.3.2
DB: mysql
- crystal_version: 1.3.2
DB: postgres
- crystal_version: 1.4.1
DB: mysql
- crystal_version: 1.4.1
DB: postgres
- crystal_version: 1.5.1
DB: mysql
- crystal_version: 1.5.1
DB: postgres
- crystal_version: 1.6.2
DB: mysql
- crystal_version: 1.6.2
DB: postgres
- crystal_version: 1.7.3
DB: mysql
- crystal_version: 1.7.3
DB: postgres
- crystal_version: 1.8.2
DB: mysql
- crystal_version: 1.8.2
DB: postgres
- crystal_version: 1.9.2
DB: mysql
- crystal_version: 1.9.2
DB: postgres
- crystal_version: 1.10.1
DB: mysql
- crystal_version: 1.10.1
DB: postgres
- crystal_version: 1.11.2
DB: mysql
- crystal_version: 1.11.2
DB: postgres
- crystal_version: 1.12.2
DB: mysql
- crystal_version: 1.12.2
DB: postgres
- crystal_version: 1.13.1
DB: mysql
os: ubuntu-24.04
integration: true
linter: true
- crystal_version: 1.13.1
DB: postgres
pg_version: '16'
os: ubuntu-24.04
integration: true
linter: true
- crystal_version: 1.13.1
DB: postgres
pg_version: '16'
os: ubuntu-24.04
other: MT=1
- crystal_version: 1.13.1
DB: postgres
pg_version: '16'
os: ubuntu-24.04
pair: true
other: PAIR_DB_USER=root PAIR_DB_PASSWORD=
- crystal_version: 1.13.1
DB: mysql
pg_version: '16'
os: ubuntu-24.04
pair: true
other: PAIR_DB_USER=dbuser PAIR_DB_PASSWORD=dbpassword
- crystal_version: nightly
DB: mysql
os: ubuntu-24.04
- crystal_version: nightly
DB: postgres
pg_version: '16'
os: ubuntu-24.04
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
env:
DB: ${{ matrix.DB }}
PAIR: ${{ matrix.pair }}
DB_USER: root
DB_PASSWORD: ${{ matrix.DB != 'mysql' && 'dbpassword' || null }}
steps:
- name: Export rest variables
run: export ${{ matrix.other }}
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{matrix.crystal_version}}
- name: Donwload sources
uses: actions/checkout@v4
- name: Install dependencies
run: |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if [ $(version '${{ matrix.crystal_version }}') -lt $(version '1.8.2') ]; then
cp .github/shard_simple.yml shard.yml
cp .github/shard.override.yml shard.override.yml
fi
shards install
- name: 'Install MySQL'
if: ${{ matrix.DB == 'mysql' || matrix.pair }}
run: bash .github/setup_mysql.sh
- name: Install PostgreSQL
if: ${{ matrix.DB == 'postgres' || matrix.pair }}
uses: Daniel-Marynicz/postgresql-action@master
with:
postgres_image_tag: ${{ matrix.pg_version || '12' }}
postgres_user: ${{ env.DB_USER }}
postgres_password: ${{ env.DB_PASSWORD }}
- name: Create configuration file
run: bash ./scripts/setup.sh .github/database.yml
- name: Run migrations
run: make sam db:setup
- name: Run specs
run: |
if [ "$MT" = "1" ]
then
crystal spec -Dpreview_mt
else
crystal spec --error-trace
fi
- name: Run integration specs
if: ${{ matrix.integration }}
run: bash .github/run_integration_tests.sh