|
| 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 | + gem_build: |
| 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: Build gem (riverqueue-ruby) |
| 33 | + run: gem build riverqueue.gemspec |
| 34 | + working-directory: . |
| 35 | + |
| 36 | + - name: Build gem (riverqueue-activerecord) |
| 37 | + run: gem build riverqueue-activerecord.gemspec |
| 38 | + working-directory: ./drivers/riverqueue-activerecord |
| 39 | + |
| 40 | + - name: Build gem (riverqueue-sequel) |
| 41 | + run: gem build riverqueue-sequel.gemspec |
| 42 | + working-directory: ./drivers/riverqueue-sequel |
| 43 | + |
| 44 | + lint: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + timeout-minutes: 3 |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Install Ruby + `bundle install` |
| 53 | + uses: ruby/setup-ruby@v1 |
| 54 | + with: |
| 55 | + ruby-version: "head" |
| 56 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 57 | + |
| 58 | + - name: Standard Ruby (riverqueue-ruby) |
| 59 | + run: bundle exec standardrb |
| 60 | + working-directory: . |
| 61 | + |
| 62 | + - name: bundle install (riverqueue-activerecord) |
| 63 | + run: bundle install |
| 64 | + working-directory: ./drivers/riverqueue-activerecord |
| 65 | + |
| 66 | + - name: Standard Ruby (riverqueue-activerecord) |
| 67 | + run: bundle exec standardrb |
| 68 | + working-directory: ./drivers/riverqueue-activerecord |
| 69 | + |
| 70 | + - name: bundle install (riverqueue-sequel) |
| 71 | + run: bundle install |
| 72 | + working-directory: ./drivers/riverqueue-sequel |
| 73 | + |
| 74 | + - name: Standard Ruby (riverqueue-sequel) |
| 75 | + run: bundle exec standardrb |
| 76 | + working-directory: ./drivers/riverqueue-sequel |
| 77 | + |
| 78 | + type_check: |
| 79 | + runs-on: ubuntu-latest |
| 80 | + timeout-minutes: 3 |
| 81 | + |
| 82 | + steps: |
| 83 | + - name: Checkout |
| 84 | + uses: actions/checkout@v4 |
| 85 | + |
| 86 | + - name: Install Ruby + `bundle install` |
| 87 | + uses: ruby/setup-ruby@v1 |
| 88 | + with: |
| 89 | + ruby-version: "head" |
| 90 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 91 | + |
| 92 | + - name: Steep (riverqueue-ruby) |
| 93 | + run: bundle exec steep check |
| 94 | + working-directory: . |
| 95 | + |
| 96 | + spec: |
| 97 | + runs-on: ubuntu-latest |
| 98 | + timeout-minutes: 3 |
| 99 | + |
| 100 | + services: |
| 101 | + postgres: |
| 102 | + image: postgres |
| 103 | + env: |
| 104 | + POSTGRES_PASSWORD: postgres |
| 105 | + options: >- |
| 106 | + --health-cmd pg_isready |
| 107 | + --health-interval 2s |
| 108 | + --health-timeout 5s |
| 109 | + --health-retries 5 |
| 110 | + ports: |
| 111 | + - 5432:5432 |
| 112 | + |
| 113 | + steps: |
| 114 | + - name: Checkout |
| 115 | + uses: actions/checkout@v4 |
| 116 | + |
| 117 | + - name: Install Ruby + `bundle install` |
| 118 | + uses: ruby/setup-ruby@v1 |
| 119 | + with: |
| 120 | + ruby-version: "head" |
| 121 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 122 | + |
| 123 | + # There is a version of Go on Actions' base image, but it's old and can't |
| 124 | + # read modern `go.mod` annotations correctly. |
| 125 | + - name: Install Go |
| 126 | + uses: actions/setup-go@v4 |
| 127 | + with: |
| 128 | + go-version: "stable" |
| 129 | + check-latest: true |
| 130 | + |
| 131 | + - name: Create database |
| 132 | + run: psql --echo-errors --quiet -c '\timing off' -c "CREATE DATABASE riverqueue_ruby_test;" ${ADMIN_DATABASE_URL} |
| 133 | + |
| 134 | + - name: Install River CLI |
| 135 | + run: go install github.com/riverqueue/river/cmd/river@latest |
| 136 | + |
| 137 | + - name: river migrate-up |
| 138 | + run: river migrate-up --database-url "$TEST_DATABASE_URL" |
| 139 | + |
| 140 | + - name: Rspec (riverqueue-ruby) |
| 141 | + run: bundle exec rspec |
| 142 | + working-directory: . |
| 143 | + |
| 144 | + - name: bundle install (riverqueue-activerecord) |
| 145 | + run: bundle install |
| 146 | + working-directory: ./drivers/riverqueue-activerecord |
| 147 | + |
| 148 | + - name: Rspec (riverqueue-activerecord) |
| 149 | + run: bundle exec rspec |
| 150 | + working-directory: ./drivers/riverqueue-activerecord |
| 151 | + |
| 152 | + - name: bundle install (riverqueue-sequel) |
| 153 | + run: bundle install |
| 154 | + working-directory: ./drivers/riverqueue-sequel |
| 155 | + |
| 156 | + - name: Rspec (riverqueue-sequel) |
| 157 | + run: bundle exec rspec |
| 158 | + working-directory: ./drivers/riverqueue-sequel |
0 commit comments