Test #117
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: Test | |
on: | |
push: | |
paths: | |
- '**.cr' | |
- '.github/workflows/test.yml' | |
- shard.latest.yml | |
pull_request: | |
branches: [master] | |
paths: | |
- '**.cr' | |
- '.github/workflows/test.yml' | |
- shard.latest.yml | |
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@v4 | |
- 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] | |
shard_file: [shard.yml] | |
include: | |
- crystal: '1.10.0' | |
experimental: false | |
shard_file: shard.latest.yml | |
- crystal: latest | |
experimental: false | |
shard_file: shard.latest.yml | |
- crystal: nightly | |
experimental: true | |
shard_file: shard.edge.yml | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Download source | |
uses: actions/checkout@v4 | |
- name: Install Crystal | |
uses: crystal-lang/install-crystal@v1 | |
with: | |
crystal: ${{ matrix.crystal }} | |
- name: Cache shards | |
uses: actions/cache@v4 | |
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 | |
env: | |
SHARDS_OVERRIDE: ${{ matrix.shard_file }} | |
- 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/bill_spec | |
SKIP_LOAD_ENV: "true" | |
run: crystal spec --error-on-warnings | |
specs__cockroachdb: | |
strategy: | |
fail-fast: false | |
matrix: | |
cockroachdb: ['v22.2.0', latest] | |
crystal: ['1.10.0'] | |
experimental: [false] | |
shard_file: [shard.yml, shard.latest.yml] | |
include: | |
- cockroachdb: latest | |
crystal: latest | |
experimental: true | |
shard_file: shard.edge.yml | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Download source | |
uses: actions/checkout@v4 | |
- name: Install Crystal | |
uses: crystal-lang/install-crystal@v1 | |
with: | |
crystal: ${{ matrix.crystal }} | |
- name: Cache shards | |
uses: actions/cache@v4 | |
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 | |
env: | |
SHARDS_OVERRIDE: ${{ matrix.shard_file }} | |
- name: Install CockroachDB | |
run: | | |
sudo apt -y install tar wget | |
sudo mkdir -p /usr/local/lib/cockroach | |
wget -O cockroachdb.tgz https://binaries.cockroachdb.com/cockroach-${{ matrix.cockroachdb }}.linux-amd64.tgz | |
tar -xzf cockroachdb.tgz | |
sudo cp -f cockroach-*/cockroach /usr/local/bin/ | |
sudo chmod +x /usr/local/bin/cockroach | |
sudo cp -rf cockroach-*/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/bill_spec?sslmode=disable | |
SKIP_LOAD_ENV: "true" | |
run: crystal spec --error-on-warnings |