|
| 1 | +name: "Atlas CI" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - "*.x" |
| 7 | + - "feature/*" |
| 8 | + push: |
| 9 | + |
| 10 | +jobs: |
| 11 | + atlas-local: |
| 12 | + runs-on: "ubuntu-latest" |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + php-version: |
| 17 | + - "8.4" |
| 18 | + symfony: |
| 19 | + - "stable" |
| 20 | + proxy: |
| 21 | + - "lazy-ghost" |
| 22 | + include: |
| 23 | + # Test with ProxyManager |
| 24 | + - php-version: "8.1" |
| 25 | + symfony: "6.4" |
| 26 | + proxy: "proxy-manager" |
| 27 | + os: "ubuntu-latest" |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: "Checkout" |
| 31 | + uses: "actions/checkout@v5" |
| 32 | + with: |
| 33 | + fetch-depth: 2 |
| 34 | + |
| 35 | + - name: "Create MongoDB Atlas Local" |
| 36 | + run: | |
| 37 | + docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:8.2 |
| 38 | + until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do |
| 39 | + sleep 1 |
| 40 | + done |
| 41 | + until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do |
| 42 | + sleep 1 |
| 43 | + done |
| 44 | +
|
| 45 | + - name: "Show MongoDB server status" |
| 46 | + run: | |
| 47 | + docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })" |
| 48 | +
|
| 49 | + - name: Setup cache environment |
| 50 | + id: extcache |
| 51 | + uses: shivammathur/cache-extensions@v1 |
| 52 | + with: |
| 53 | + php-version: ${{ matrix.php-version }} |
| 54 | + extensions: "mongodb, bcmath" |
| 55 | + key: "extcache-v1" |
| 56 | + |
| 57 | + - name: Cache extensions |
| 58 | + uses: actions/cache@v4 |
| 59 | + with: |
| 60 | + path: ${{ steps.extcache.outputs.dir }} |
| 61 | + key: ${{ steps.extcache.outputs.key }} |
| 62 | + restore-keys: ${{ steps.extcache.outputs.key }} |
| 63 | + |
| 64 | + - name: "Install PHP" |
| 65 | + uses: "shivammathur/setup-php@v2" |
| 66 | + with: |
| 67 | + php-version: "${{ matrix.php-version }}" |
| 68 | + tools: "pecl" |
| 69 | + extensions: "mongodb, bcmath" |
| 70 | + coverage: "none" |
| 71 | + ini-values: "zend.assertions=1" |
| 72 | + |
| 73 | + - name: "Show driver information" |
| 74 | + run: "php --ri mongodb" |
| 75 | + |
| 76 | + # Not used, skip transient dependencies |
| 77 | + - name: "Remove phpbench/phpbench" |
| 78 | + run: composer remove --no-update --dev phpbench/phpbench |
| 79 | + |
| 80 | + - name: "Configure Symfony ${{ matrix.symfony }}" |
| 81 | + if: "${{ matrix.symfony != 'stable' }}" |
| 82 | + run: | |
| 83 | + composer config minimum-stability dev |
| 84 | + # update symfony deps |
| 85 | + composer require --no-update symfony/console:^${{ matrix.symfony }} |
| 86 | + composer require --no-update symfony/var-dumper:^${{ matrix.symfony }} |
| 87 | + composer require --no-update --dev symfony/cache:^${{ matrix.symfony }} |
| 88 | +
|
| 89 | + - name: "Install dependencies with Composer" |
| 90 | + uses: "ramsey/composer-install@v3" |
| 91 | + with: |
| 92 | + dependency-versions: "highest" |
| 93 | + composer-options: "--prefer-dist" |
| 94 | + |
| 95 | + - name: "Run PHPUnit with Atlas Local" |
| 96 | + run: "vendor/bin/phpunit --group atlas" |
| 97 | + env: |
| 98 | + DOCTRINE_MONGODB_SERVER: "mongodb://127.0.0.1:27017/?directConnection=true" |
| 99 | + USE_LAZY_GHOST_OBJECTS: ${{ matrix.proxy == 'lazy-ghost' && '1' || '0' }} |
0 commit comments