|
1 | 1 | name: Tests |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
4 | 8 |
|
5 | 9 | jobs: |
6 | 10 | gemstash_tests: |
|
9 | 13 | fail-fast: false |
10 | 14 | matrix: |
11 | 15 | ruby: ["3.1", "3.2", "3.3", "jruby-9.4"] |
| 16 | + db_adapter: ["sqlite3"] |
| 17 | + cache_type: ["memory"] |
| 18 | + include: |
| 19 | + - ruby: "3.3" |
| 20 | + db_adapter: "postgres" |
| 21 | + cache_type: "memory" |
| 22 | + - ruby: "3.3" |
| 23 | + db_adapter: "mysql2" |
| 24 | + cache_type: "memory" |
| 25 | + - ruby: "3.3" |
| 26 | + db_adapter: "sqlite3" |
| 27 | + cache_type: "memcached" |
| 28 | + - ruby: "3.3" |
| 29 | + db_adapter: "sqlite3" |
| 30 | + cache_type: "redis" |
| 31 | + - ruby: "jruby-9.4" |
| 32 | + db_adapter: "sqlite3" |
| 33 | + cache_type: "memcached" |
| 34 | + - ruby: "jruby-9.4" |
| 35 | + db_adapter: "sqlite3" |
| 36 | + cache_type: "redis" |
| 37 | + services: |
| 38 | + postgres: |
| 39 | + image: postgres:13 |
| 40 | + env: |
| 41 | + POSTGRES_USER: postgres |
| 42 | + POSTGRES_PASSWORD: postgres |
| 43 | + POSTGRES_DB: gemstash_test |
| 44 | + ports: |
| 45 | + - 5432:5432 |
| 46 | + memcached: |
| 47 | + image: memcached:1.6 |
| 48 | + ports: |
| 49 | + - 11211:11211 |
| 50 | + redis: |
| 51 | + image: redis:7 |
| 52 | + ports: |
| 53 | + - 6379:6379 |
| 54 | + env: |
| 55 | + GEMSTASH_SPEC_CACHE_TYPE: ${{ matrix.cache_type }} |
| 56 | + GEMSTASH_SPEC_DB_ADAPTER: ${{ matrix.db_adapter }} |
| 57 | + GEMSTASH_SPEC_DB_URL: ${{ (matrix.db_adapter == 'postgres' && 'postgres://postgres:postgres@localhost/gemstash_test') || (matrix.db_adapter == 'mysql2' && 'mysql2://root:[email protected]:3306/gemstash_test') }} |
| 58 | + GEMSTASH_SPEC_REDIS_SERVERS: redis://localhost:6379 |
| 59 | + GEMSTASH_SPEC_MEMCACHED_SERVERS: localhost:11211 |
12 | 60 | steps: |
13 | 61 | - uses: actions/checkout@v4 |
14 | 62 | - name: Setup ruby |
|
18 | 66 | bundler-cache: true # 'bundle install' and cache |
19 | 67 | - name: increase ulimit |
20 | 68 | run: ulimit -n 8192 |
| 69 | + - name: Set up MySQL |
| 70 | + if: matrix.db_adapter == 'mysql2' |
| 71 | + run: | |
| 72 | + set -eux |
| 73 | + sudo /etc/init.d/mysql start |
| 74 | + mysql -e 'CREATE DATABASE gemstash_test;' --user=root --password=root |
| 75 | + mysqladmin ping --user=root --password=root |
21 | 76 | - name: Run Tests |
22 | 77 | run: bundle exec rspec --exclude-pattern "spec/integration_spec.rb" |
23 | 78 | - name: Run Integration Tests |
24 | 79 | run: bundle exec rspec ./spec/integration_spec.rb |
25 | 80 | timeout-minutes: 60 |
| 81 | + |
| 82 | + all-tests-pass: |
| 83 | + if: always() |
| 84 | + |
| 85 | + needs: |
| 86 | + - gemstash_tests |
| 87 | + |
| 88 | + runs-on: ubuntu-latest |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: check test jobs |
| 92 | + uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 |
| 93 | + with: |
| 94 | + jobs: ${{ toJSON(needs) }} |
0 commit comments