Skip to content

Commit

Permalink
Migrate to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Mar 16, 2022
1 parent 1f5f684 commit c27221f
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 104 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Continuous Integration
on:
push:
branches:
- master
pull_request:
jobs:
supported-versions-matrix:
name: Supported Versions Matrix
runs-on: ubuntu-latest
outputs:
version: ${{ steps.supported-versions-matrix.outputs.version }}
steps:
- uses: actions/checkout@v2
- id: supported-versions-matrix
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
test:
name: "Run Tests on PHP ${{ matrix.php }} against RabbitMQ ${{ matrix.rabbitmq }} (Composer: ${{ matrix.composer }}; TLS: ${{ matrix.ssl_test }})"
runs-on: ubuntu-latest
needs:
- supported-versions-matrix
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [lowest, locked, highest]
rabbitmq: ["3", "3.9"]
ssl_test: ["no", "yes", "client"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, ctype, iconv, bcmath, filter, json
tools: composer
- name: Install Dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.composer }}
- name: RabbitMQ TLS Certificates
if: matrix.ssl_test != 'no'
run: |
cd test/ssl
make all
ls -lasth
sudo chown 999:999 ./{ca.pem,server.pem,server.key}
ls -lasth
- name: Start RabbitMQ
if: matrix.ssl_test == 'no'
uses: namoshek/rabbitmq-github-action@v1
with:
version: '${{ matrix.rabbitmq }}-management'
ports: '5672:5672 15672:15672'
container-name: 'rabbitmq'
- name: Start RabbitMQ
if: matrix.ssl_test == 'yes'
uses: namoshek/rabbitmq-github-action@v1
with:
version: '${{ matrix.rabbitmq }}-management'
ports: '5673:5673 5672:5672 15672:15672'
container-name: 'rabbitmq'
certificates: ${{ github.workspace }}/test/ssl
config: ${{ github.workspace }}/test/ssl/rabbitmq.ssl.verify_none.conf
- name: Start RabbitMQ
if: matrix.ssl_test == 'client'
uses: namoshek/rabbitmq-github-action@v1
with:
version: '${{ matrix.rabbitmq }}-management'
ports: '5673:5673 5672:5672 15672:15672'
container-name: 'rabbitmq'
certificates: ${{ github.workspace }}/test/ssl
config: ${{ github.workspace }}/test/ssl/rabbitmq.ssl.verify_peer.conf
- uses: ifaxity/wait-on-action@v1
with:
resource: http://localhost:15672/
timeout: 13000
interval: 100
- name: Run UnitTests
if: matrix.ssl_test == 'no'
run: ./vendor/bin/phpunit
- name: Run UnitTests
if: matrix.ssl_test == 'yes'
run: ./vendor/bin/phpunit
env:
SSL_TEST: "yes"
SSL_CA: "ssl/ca.pem"
SSL_PEER_NAME: "server.rmq"
- name: Run UnitTests
if: matrix.ssl_test == 'client'
run: ./vendor/bin/phpunit
env:
SSL_TEST: "yes"
SSL_CA: "ssl/ca.pem"
SSL_PEER_NAME: "server.rmq"
SSL_CLIENT_CERT: "ssl/client.pem"
SSL_CLIENT_KEY: "ssl/client.key"
- name: Docker Logs
if: ${{ failure() }}
run: docker logs rabbitmq
48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"react/promise": "~2.2"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.3"
"phpunit/phpunit": "^9.5 || ^7.5.20"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<php>
<!-- This is the default configuration when running the test suite
through the docker-compose setup -->
<env name="TEST_RABBITMQ_CONNECTION_URI" value="amqp://testuser:testpassword@rabbit_node_1:5672/testvhost"/>
<env name="TEST_RABBITMQ_CONNECTION_URI" value="amqp://guest:guest@localhost:5672/"/>

<!-- RabbitMQ running on localhost with default user (guest:guest) and
vhost "/" would be (slashes in the actual vhost name need to be
Expand Down
6 changes: 5 additions & 1 deletion test/Library/AbstractClientHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ protected function parseAmqpUri($uri): array
$options['vhost'] = $vhostCandidate;
}

if ($options['vhost'] === '') {
$options['vhost'] = '/';
}

return $options;
}
}
}
8 changes: 4 additions & 4 deletions test/ssl/rabbitmq.ssl.verify_none.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# for RMQ 3.7.0 and above

loopback_users = none
listeners.tcp.default = 5672

listeners.ssl.default = 5673
ssl_options.cacertfile = /etc/rabbitmq/ca.pem
ssl_options.certfile = /etc/rabbitmq/server.pem
ssl_options.keyfile = /etc/rabbitmq/server.key
ssl_options.cacertfile = /rabbitmq-certs/ca.pem
ssl_options.certfile = /rabbitmq-certs/server.pem
ssl_options.keyfile = /rabbitmq-certs/server.key
ssl_options.verify = verify_none
ssl_options.fail_if_no_peer_cert = false
13 changes: 0 additions & 13 deletions test/ssl/rabbitmq.ssl.verify_none.config

This file was deleted.

8 changes: 4 additions & 4 deletions test/ssl/rabbitmq.ssl.verify_peer.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# for RMQ 3.7.0 and above

loopback_users = none
listeners.tcp.default = 5672

listeners.ssl.default = 5673
ssl_options.cacertfile = /etc/rabbitmq/ca.pem
ssl_options.certfile = /etc/rabbitmq/server.pem
ssl_options.keyfile = /etc/rabbitmq/server.key
ssl_options.cacertfile = /rabbitmq-certs/ca.pem
ssl_options.certfile = /rabbitmq-certs/server.pem
ssl_options.keyfile = /rabbitmq-certs/server.key
ssl_options.verify = verify_peer
ssl_options.fail_if_no_peer_cert = true
13 changes: 0 additions & 13 deletions test/ssl/rabbitmq.ssl.verify_peer.config

This file was deleted.

19 changes: 0 additions & 19 deletions test/ssl/travis.sh

This file was deleted.

0 comments on commit c27221f

Please sign in to comment.