Repository navigation
69 lines (66 loc) · 2.78 KB
/
Copy pathtest.yml
File metadata and controls
69 lines (66 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Test
on:
push:
branches: [master]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
test:
name: Ruby ${{ matrix.ruby }} / Mongoid ${{ matrix.mongoid }} / MongoDB ${{ matrix.mongodb }}
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- { ruby: '2.6.10', mongoid: '7', mongodb: '4.4', bundler: '2.4.22' }
- { ruby: '2.7.8', mongoid: '7', mongodb: '4.4', bundler: '2.4.22' }
- { ruby: '3.0', mongoid: '7', mongodb: '5.0', bundler: default }
- { ruby: '3.1', mongoid: '7', mongodb: '5.0', bundler: default }
- { ruby: '3.2', mongoid: '8', mongodb: '6.0', bundler: default }
- { ruby: '3.3', mongoid: '9', mongodb: '7.0', bundler: default }
- { ruby: '3.4', mongoid: '9', mongodb: '8.0', bundler: default }
- { ruby: '4.0', mongoid: '9', mongodb: '8.0', bundler: default, coverage: true }
env:
MONGOID_VERSION: ${{ matrix.mongoid }}
COVERAGE: ${{ matrix.coverage }}
MONGODB_HOST: localhost:27018
services:
mongodb:
image: mongo:${{ matrix.mongodb }}
ports: ['27017:27017', '27018:27018']
options: >-
--health-cmd "bash -c 'echo > /dev/tcp/127.0.0.1/27017'"
--health-interval 5s --health-timeout 5s --health-retries 20
steps:
- uses: actions/checkout@v6
- name: Configure replica set
env:
CONTAINER: ${{ job.services.mongodb.id }}
run: |
docker exec "$CONTAINER" bash -c 'mkdir -p /data/ci-rs && mongod --replSet rs0 --bind_ip_all --port 27018 --dbpath /data/ci-rs --logpath /data/ci-rs/mongod.log --fork'
shell=mongosh
if docker exec "$CONTAINER" bash -c 'command -v mongo >/dev/null'; then shell=mongo; fi
docker exec "$CONTAINER" "$shell" --port 27018 --quiet --eval 'rs.initiate({_id:"rs0",members:[{_id:0,host:"localhost:27018"}]})'
for _ in $(seq 1 60); do
if docker exec "$CONTAINER" "$shell" --port 27018 --quiet --eval 'quit(db.isMaster().ismaster ? 0 : 1)'; then break; fi
sleep 1
done
docker exec "$CONTAINER" "$shell" --port 27018 --quiet --eval 'quit(db.isMaster().ismaster ? 0 : 1)'
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ matrix.bundler }}
bundler-cache: true
- run: bundle exec rake spec
- name: Report coverage to Coveralls
if: matrix.coverage
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage/.resultset.json
format: simplecov