Skip to content

Limit CI workflows to supported branches #3411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 91 additions & 85 deletions .github/workflows/build-ci-atlas.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,100 @@
name: "Atlas CI"

on:
push:
pull_request:
push:
branches:
- "[0-9]+.[0-9x]+"
- "feature/*"
pull_request:
branches:
- "[0-9]+.[0-9x]+"
Comment on lines +8 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we create a feature/* branch, the CI will not run on the PR targeting this feature branch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a commit to add this to all workflows.

- "feature/*"

env:
MONGODB_EXT_V1: mongodb-1.21.0
MONGODB_EXT_V2: stable

jobs:
build:
runs-on: "${{ matrix.os }}"

name: "PHP/${{ matrix.php }} Laravel/${{ matrix.laravel }} Driver/${{ matrix.driver }}"

strategy:
matrix:
os:
- "ubuntu-latest"
php:
- "8.2"
- "8.3"
- "8.4"
laravel:
- "11.*"
- "12.*"
driver:
- 1
include:
- php: "8.4"
laravel: "12.*"
os: "ubuntu-latest"
driver: 2

steps:
- uses: "actions/checkout@v4"

- name: "Create MongoDB Atlas Local"
run: |
docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:latest
until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do
sleep 1
done
until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do
sleep 1
done

- name: "Show MongoDB server status"
run: |
docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })"

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.driver == 1 && env.MONGODB_EXT_V1 || env.MONGODB_EXT_V2 }}
key: "extcache-v1"

- name: "Installing php"
uses: "shivammathur/setup-php@v2"
with:
php-version: ${{ matrix.php }}
extensions: "curl,mbstring,xdebug,${{ matrix.driver == 1 && env.MONGODB_EXT_V1 || env.MONGODB_EXT_V2 }}"
coverage: "xdebug"
tools: "composer"

- name: "Show Docker version"
if: ${{ runner.debug }}
run: "docker version && env"

- name: "Restrict Laravel version"
run: "composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'"

- name: "Download Composer cache dependencies from cache"
id: "composer-cache"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache Composer dependencies"
uses: "actions/cache@v4"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ matrix.os }}-composer-"

- name: "Install dependencies"
run: |
composer update --no-interaction

- name: "Run tests"
run: |
export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true"
php -d zend.assertions=1 ./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search
build:
runs-on: "${{ matrix.os }}"

name: "PHP/${{ matrix.php }} Laravel/${{ matrix.laravel }} Driver/${{ matrix.driver }}"

strategy:
matrix:
os:
- "ubuntu-latest"
php:
- "8.2"
- "8.3"
- "8.4"
laravel:
- "11.*"
- "12.*"
driver:
- 1
include:
- php: "8.4"
laravel: "12.*"
os: "ubuntu-latest"
driver: 2

steps:
- uses: "actions/checkout@v4"

- name: "Create MongoDB Atlas Local"
run: |
docker run --name mongodb -p 27017:27017 --detach mongodb/mongodb-atlas-local:latest
until docker exec --tty mongodb mongosh --eval "db.runCommand({ ping: 1 })"; do
sleep 1
done
until docker exec --tty mongodb mongosh --eval "db.createCollection('connection_test') && db.getCollection('connection_test').createSearchIndex({mappings:{dynamic: true}})"; do
sleep 1
done

- name: "Show MongoDB server status"
run: |
docker exec --tty mongodb mongosh --eval "db.runCommand({ serverStatus: 1 })"

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.driver == 1 && env.MONGODB_EXT_V1 || env.MONGODB_EXT_V2 }}
key: "extcache-v1"

- name: "Installing php"
uses: "shivammathur/setup-php@v2"
with:
php-version: ${{ matrix.php }}
extensions: "curl,mbstring,xdebug,${{ matrix.driver == 1 && env.MONGODB_EXT_V1 || env.MONGODB_EXT_V2 }}"
coverage: "xdebug"
tools: "composer"

- name: "Show Docker version"
if: ${{ runner.debug }}
run: "docker version && env"

- name: "Restrict Laravel version"
run: "composer require --dev --no-update 'laravel/framework:${{ matrix.laravel }}'"

- name: "Download Composer cache dependencies from cache"
id: "composer-cache"
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache Composer dependencies"
uses: "actions/cache@v4"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ matrix.os }}-composer-"

- name: "Install dependencies"
run: |
composer update --no-interaction

- name: "Run tests"
run: |
export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true"
php -d zend.assertions=1 ./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search
Loading
Loading