-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-606: Move CI checks from travis-ci to GitHub Actions #802
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f15d429
Move phpcs checks to GitHub actions
alcaeus 60de74f
Test standalones on PHP 7.4 and PHP 8 on GitHub Actions
alcaeus 9a61631
Use drivers-evergreen-tools to install and run MongoDB
alcaeus 8b866f1
Test PHP 8 on replica sets and sharded clusters
alcaeus ab0a083
Remove travis-ci configs
alcaeus 89c84a3
Replace travis-ci badge with GitHub Actions badges
alcaeus 018f4fb
Fix server selection check for documentation examples
alcaeus 9d9e230
Ensure consistent build names
alcaeus 3f9c717
Fix fail-fast setting
alcaeus 0aaae69
Run CI checks on selected branches only
alcaeus cc731f2
Explain using countDocuments to check for secondary servers
alcaeus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: "Coding Standards" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "v*.*" | ||
- "master" | ||
push: | ||
branches: | ||
- "v*.*" | ||
- "master" | ||
|
||
jobs: | ||
coding-standards: | ||
name: "Coding Standards" | ||
runs-on: "ubuntu-20.04" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.4" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: Setup cache environment | ||
id: extcache | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: "mongodb" | ||
key: "extcache-v1" | ||
|
||
- name: Cache extensions | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.extcache.outputs.dir }} | ||
key: ${{ steps.extcache.outputs.key }} | ||
restore-keys: ${{ steps.extcache.outputs.key }} | ||
|
||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "none" | ||
extensions: "mongodb" | ||
php-version: "${{ matrix.php-version }}" | ||
tools: "cs2pr" | ||
|
||
- name: "Show driver information" | ||
run: "php --ri mongodb" | ||
|
||
- name: "Cache dependencies installed with Composer" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-" | ||
|
||
- name: "Require doctrine/coding-standard" | ||
run: "composer require --no-update doctrine/coding-standard=^6.0" | ||
|
||
- name: "Install dependencies with Composer" | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
|
||
# The -q option is required until phpcs v4 is released | ||
- name: "Run PHP_CodeSniffer" | ||
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: "Tests" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "v*.*" | ||
- "master" | ||
push: | ||
branches: | ||
- "v*.*" | ||
- "master" | ||
|
||
jobs: | ||
phpunit: | ||
name: "PHPUnit tests" | ||
runs-on: "${{ matrix.os }}" | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: | ||
- "ubuntu-20.04" | ||
php-version: | ||
- "7.4" | ||
- "8.0" | ||
mongodb-version: | ||
- "4.4" | ||
driver-version: | ||
- "stable" | ||
topology: | ||
- "server" | ||
include: | ||
- os: "ubuntu-20.04" | ||
php-version: "8.0" | ||
mongodb-version: "4.4" | ||
driver-version: "stable" | ||
topology: "replica_set" | ||
- os: "ubuntu-20.04" | ||
php-version: "8.0" | ||
mongodb-version: "4.4" | ||
driver-version: "stable" | ||
topology: "sharded_cluster" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
with: | ||
fetch-depth: 2 | ||
|
||
- id: setup-mongodb | ||
uses: mongodb-labs/drivers-evergreen-tools@master | ||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
version: ${{ matrix.mongodb-version }} | ||
topology: ${{ matrix.topology }} | ||
|
||
- name: Setup cache environment | ||
id: extcache | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: "mongodb-${{ matrix.driver-version }}" | ||
key: "extcache-v1" | ||
|
||
- name: Cache extensions | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.extcache.outputs.dir }} | ||
key: ${{ steps.extcache.outputs.key }} | ||
restore-keys: ${{ steps.extcache.outputs.key }} | ||
|
||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
tools: "pecl" | ||
extensions: "mongodb-${{ matrix.driver-version }}" | ||
coverage: "none" | ||
ini-values: "zend.assertions=1" | ||
|
||
- name: "Show driver information" | ||
run: "php --ri mongodb" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" | ||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-" | ||
|
||
- name: "Install dependencies with composer" | ||
run: "composer update --no-interaction --no-progress" | ||
|
||
- name: "Run PHPUnit" | ||
run: "vendor/bin/simple-phpunit -v" | ||
env: | ||
SYMFONY_DEPRECATIONS_HELPER: 999999 | ||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any concerns with depending on third-party repositories for action recipes? I imagine if this was taken down our CI builds would break (among many others). Might there be security concerns we were using encrypted environment variables (e.g. Atlas testing) and an action dependency was compromised?
AFAIK, secrets are only tested with Evergreen so this may be a hypothetical question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, our CI builds would break in that case, but I'd expect a fork to spring up relatively soon considering how widely used these actions are.
Good question, I haven't considered yet. Quoting from the secrets documentation:
Reading this, any secrets defined in our org or repo would have to be passed on to third-party actions as input or environment variables (either using
with
orenv
keys). I'd assume that a compromised third-party action file would not gain access to secrets defined in our repository, but I concede I haven't tested this (yet).That said, I haven't configured any secrets yet, so we're not running any AWS tests or anything. We can decide to do this at a later date, or we can leave testing with secrets to our evergreen pipeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say nothing to do here, but something to keep in mind if you have grander plans for moving drivers onto GitHub Actions down the line. Maybe you want to add a line about this in your scope doc, but I reckon it's potentially future work since you were only focused on a subset of tests for quick PR feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do to make sure other engineers are aware, although I want this to be a subset for quick PR feedback in all drivers for the time being.