|
| 1 | +name: CI |
| 2 | + |
| 3 | +env: |
| 4 | + # Database to connect to that can create other databases with `CREATE DATABASE`. |
| 5 | + ADMIN_DATABASE_URL: postgres://postgres:postgres@localhost:5432 |
| 6 | + |
| 7 | + # Just a common place for steps to put binaries they need and which is added |
| 8 | + # to GITHUB_PATH/PATH. |
| 9 | + BIN_PATH: /home/runner/bin |
| 10 | + |
| 11 | + # A suitable URL for a test database. |
| 12 | + TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/riverqueue_ruby_test?sslmode=disable |
| 13 | + |
| 14 | +on: |
| 15 | + - push |
| 16 | + |
| 17 | +jobs: |
| 18 | + lint: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + timeout-minutes: 3 |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Install Ruby + `bundle install` |
| 27 | + uses: ruby/setup-ruby@v1 |
| 28 | + with: |
| 29 | + ruby-version: "head" |
| 30 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 31 | + |
| 32 | + - name: Standard Ruby (riverqueue-ruby) |
| 33 | + run: bundle exec standardrb |
| 34 | + working-directory: . |
| 35 | + |
| 36 | + - name: bundle install (riverqueue-activerecord) |
| 37 | + run: bundle install |
| 38 | + working-directory: ./drivers/riverqueue-activerecord |
| 39 | + |
| 40 | + - name: Standard Ruby (riverqueue-activerecord) |
| 41 | + run: bundle exec standardrb |
| 42 | + working-directory: ./drivers/riverqueue-activerecord |
| 43 | + |
| 44 | + - name: bundle install (riverqueue-sequel) |
| 45 | + run: bundle install |
| 46 | + working-directory: ./drivers/riverqueue-sequel |
| 47 | + |
| 48 | + - name: Standard Ruby (riverqueue-sequel) |
| 49 | + run: bundle exec standardrb |
| 50 | + working-directory: ./drivers/riverqueue-sequel |
| 51 | + |
| 52 | + spec: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + timeout-minutes: 3 |
| 55 | + |
| 56 | + services: |
| 57 | + postgres: |
| 58 | + image: postgres |
| 59 | + env: |
| 60 | + POSTGRES_PASSWORD: postgres |
| 61 | + options: >- |
| 62 | + --health-cmd pg_isready |
| 63 | + --health-interval 2s |
| 64 | + --health-timeout 5s |
| 65 | + --health-retries 5 |
| 66 | + ports: |
| 67 | + - 5432:5432 |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Install Ruby + `bundle install` |
| 74 | + uses: ruby/setup-ruby@v1 |
| 75 | + with: |
| 76 | + ruby-version: "head" |
| 77 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 78 | + |
| 79 | + # There is a version of Go on Actions' base image, but it's old and can't |
| 80 | + # read modern `go.mod` annotations correctly. |
| 81 | + - name: Install Go |
| 82 | + uses: actions/setup-go@v4 |
| 83 | + with: |
| 84 | + go-version: "stable" |
| 85 | + check-latest: true |
| 86 | + |
| 87 | + - name: Create database |
| 88 | + run: psql --echo-errors --quiet -c '\timing off' -c "CREATE DATABASE riverqueue_ruby_test;" ${ADMIN_DATABASE_URL} |
| 89 | + |
| 90 | + - name: Install River CLI |
| 91 | + run: go install github.com/riverqueue/river/cmd/river@latest |
| 92 | + |
| 93 | + - name: river migrate-up |
| 94 | + run: river migrate-up --database-url "$TEST_DATABASE_URL" |
| 95 | + |
| 96 | + - name: Rspec (riverqueue-ruby) |
| 97 | + run: bundle exec rspec |
| 98 | + working-directory: . |
| 99 | + |
| 100 | + - name: bundle install (riverqueue-activerecord) |
| 101 | + run: bundle install |
| 102 | + working-directory: ./drivers/riverqueue-activerecord |
| 103 | + |
| 104 | + - name: Rspec (riverqueue-activerecord) |
| 105 | + run: bundle exec rspec |
| 106 | + working-directory: ./drivers/riverqueue-activerecord |
| 107 | + |
| 108 | + - name: bundle install (riverqueue-sequel) |
| 109 | + run: bundle install |
| 110 | + working-directory: ./drivers/riverqueue-sequel |
| 111 | + |
| 112 | + - name: Rspec (riverqueue-sequel) |
| 113 | + run: bundle exec rspec |
| 114 | + working-directory: ./drivers/riverqueue-sequel |
0 commit comments