Skip to content

CI

CI #334

Workflow file for this run

name: CI
on:
push:
paths:
- '**.cr'
- '.github/workflows/**'
pull_request:
branches: [master]
paths:
- '**.cr'
- '.github/workflows/**'
schedule:
- cron: '0 6 * * 6'
jobs:
checks:
strategy:
fail-fast: false
matrix:
crystal: [1.6.0]
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Install shards
run: shards install
- name: Lint code
run: ./bin/ameba
specs__postgresql:
strategy:
fail-fast: false
matrix:
crystal: [1.6.0, latest]
experimental: [false]
include:
- crystal: nightly
experimental: true
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v3
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-
- name: Install shards
run: shards update --skip-postinstall --skip-executables
- name: Install Postgresql
run: sudo apt -y install postgresql
- name: Start Postgresql
run: sudo systemctl start postgresql
- name: Set Postgres password
run: >-
sudo -u postgres psql -c
"ALTER USER postgres WITH PASSWORD 'password';"
- name: Run tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/shield_spec
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings
specs__cockroachdb:
strategy:
fail-fast: false
matrix:
cockroachdb: [22.2.2]
crystal: [1.6.0]
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v3
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-
- name: Install shards
run: shards update --skip-postinstall --skip-executables
- name: Install CockroachDB
run: |
sudo apt -y install tar wget
sudo mkdir -p /usr/local/lib/cockroach
wget https://binaries.cockroachdb.com/cockroach-v${{ matrix.cockroachdb }}.linux-amd64.tgz
tar -xzf cockroach-v${{ matrix.cockroachdb }}.linux-amd64.tgz
sudo cp -f cockroach-v${{ matrix.cockroachdb }}.linux-amd64/cockroach /usr/local/bin/
sudo chmod +x /usr/local/bin/cockroach
sudo cp -rf cockroach-v${{ matrix.cockroachdb }}.linux-amd64/lib/* /usr/local/lib/cockroach/
working-directory: /tmp
- name: Start CockroachDB
run: cockroach start-single-node --insecure --listen-addr=localhost:36257 --sql-addr=localhost:26257 --background
- name: Run tests
env:
DATABASE_URL: postgres://root@localhost:26257/shield_spec?sslmode=disable
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings