Actions Step hangs indefinitely with no info

Hello,

I am unable to complete my build pipeline. After 6h the pipeline was canceled with no useful information why it took so long or if there was any error. I tried to run it before few times and always cancelled it manually after 20-30min as it is doing nothing.

My RoR app works fine when building locally or running rspec. Only in Actions it does not behave as expected.

Any idea what could be wrong?

This is my pipeline code:

---
name: 'CI/CD'

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:11
        env:
          POSTGRES_DB: dostack_backend_test
          POSTGRES_USER: postgres
          POSTGRES_HOST_AUTH_METHOD: trust
        ports: [ '5432:5432' ]
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v2
      - name: Set up Ruby 2.7
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7.2
      - name: Use bundler cache
        uses: actions/cache@v2
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - name: Build and test with Rake
        env:
          RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
          RAILS_ENV: test
        run: |
          sudo apt-get -yqq install libpq-dev
          gem install bundler
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3
          bundle exec rails db:create
          bundle exec rails db:migrate
          bundle exec rspec

Screen:

Answering own question :). I was able to get more details from the pipeline run - 1 out of 10 pipeline runs it printed more details and the issue was that the process of attaching file to DB could not be exited for some reason during seeding phase. Interesting is that I was not able to reproduce it locally, but after applying the workaround the pipeline works just fine.

Log:

Solution:
More details about the issue and also working workaround: Running rails db:seed with File I/O will cause process to hang · Issue #33500 · rails/rails · GitHub