Skip to content

Fx tu

Fx tu #296

Workflow file for this run

name: Test Ruby
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis
env:
POSTGRES_DB: api
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 5432:5432
steps:
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: postgresql-client libgeos-dev libproj-dev
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
cache-version: 1
- name: Setup test database
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432/api
run: bundle exec rails db:setup
- name: Run rubocop
run: bundle exec rubocop --parallel -c .rubocop.yml
- name: Run typecheck
run: |
bundle exec tapioca init && \
bundle exec rake rails_rbi:routes && \
bundle exec srb rbi suggest-typed && \
bundle exec srb typecheck -q
# bundle exec tapioca dsl && \
# - name: Run security checks
# run: |
# bin/bundler-audit --update
# bin/brakeman -q -w2
- name: Run tests
run: bundle exec rake test
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/api
- name: Run tests SQL
run: bundle exec rake test:sql
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/api
deploy_dev:
needs:
- test
if: github.ref == 'refs/heads/dev' && ${{vars.DEPLOY_SSH_HOST}} != ''
name: Deploy Dev
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Deploy
uses: appleboy/[email protected]
with:
host: ${{vars.DEPLOY_SSH_HOST}}
username: ${{vars.DEPLOY_SSH_USERNAME}}
key: ${{secrets.DEPLOY_SSH_KEY_DEV}}
port: 2222
script: |
echo -n 'Deployment started at: ' &&
date -u &&
cd ${{vars.DEPLOY_SSH_PATH}} &&
git fetch &&
git checkout -f origin/dev &&
git submodule init &&
git submodule update &&
docker compose --profile "*" build &&
docker compose up -d &&
echo -n 'Deployment completed at: ' &&
date -u