Manuel Bustillo
8a9d0bfdb8
Some checks failed
Check usage of free licenses / check-licenses (pull_request) Failing after 47s
Add copyright notice / copyright_notice (pull_request) Successful in 1m16s
Run unit tests / unit_tests (pull_request) Successful in 4m34s
Build Nginx-based docker image / build-static-assets (pull_request) Failing after 11m25s
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
name: Run unit tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
concurrency:
|
|
group: ${{ github.ref }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
unit_tests:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- 5432
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: ruby/setup-ruby@v1.207.0
|
|
- run: bundle install
|
|
- run: bundle exec rubocop --force-exclusion --parallel
|
|
- name: Wait until Postgres is ready to accept connections
|
|
run: |
|
|
apt-get update && apt-get install -f -y postgresql-client
|
|
until pg_isready -h postgres -U postgres -d postgres
|
|
do
|
|
sleep 1
|
|
echo "Trying again"
|
|
done
|
|
- run: |
|
|
bundle exec rake db:schema:load
|
|
bundle exec rspec
|
|
env:
|
|
RAILS_ENV: test
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
|
|
- name: Clean up containers generated by this flow
|
|
if: failure()
|
|
run: docker ps --filter network=$JOB_CONTAINER_NAME-$GITHUB_JOB-network --filter name=$JOB_CONTAINER_NAME-* --format "{{.ID}}" | xargs docker rm -f
|