Merge pull request #68 from alxsabo/v5.2 #302
This file contains 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
name: Run unit tests | |
on: | |
schedule: | |
- cron: "0 10 * * 6" | |
push: | |
branches: [ v5.2 ] | |
pull_request: | |
branches: [ v5.2 ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: [ "8.1", "8.2" ] | |
serverVersion: [ "5.2", "5.4" ] | |
fail-fast: false | |
env: | |
RAVENDB_BUILD_TYPE: nightly | |
RAVEN_License: ${{ secrets.RAVEN_LICENSE }} | |
RAVENDB_PHP_TEST_HTTPS_SERVER_URL: "https://localhost:8081" | |
RAVENDB_TEST_CLIENT_CERT_PASSPHRASE: "" | |
RAVENDB_PHP_TEST_CERTIFICATE_PATH: "./RavenDB/Server/certs/server.pfx" | |
RAVENDB_PHP_TEST_CA_PATH: "/usr/local/share/ca-certificates/ca.crt" | |
RAVENDB_TEST_CLIENT_CERT_PATH: "./certs/java.pem" | |
SERVER_VERSION: ${{ matrix.serverVersion }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ds, json, fileinfo, zip | |
# ini-values: "post_max_size=256M" | |
tools: composer:v2, phpunit:v9.6 | |
coverage: none | |
- name: Check PHP Version | |
run: php -v | |
- name: Download RavenDB Server | |
run: wget -q -O RavenDB.tar.bz2 "https://hibernatingrhinos.com/downloads/RavenDB%20for%20Linux%20x64/latest?buildType=${{ env.RAVENDB_BUILD_TYPE }}&version=${{ matrix.serverVersion }}" | |
- name: Extract RavenDB Server | |
run: tar xjf RavenDB.tar.bz2 | |
- name: Run RDB | |
run: ./RavenDB/Server/Raven.Server -c $(realpath ./settings.json) & | |
- name: Wait for server to run | |
run: while ! curl http://127.0.0.1:8080; do sleep 0.2; echo "Waiting for server to start..."; done | |
- run: mkdir certs | |
- run: openssl genrsa -out certs/ca.key 2048 | |
- run: openssl req -new -x509 -key certs/ca.key -out certs/ca.crt -subj "/C=US/ST=Arizona/L=Nevada/O=RavenDB Test CA/OU=RavenDB test CA/CN=localhost/[email protected]" | |
- run: openssl genrsa -out certs/localhost.key 2048 | |
- run: openssl req -new -key certs/localhost.key -out certs/localhost.csr -subj "/C=US/ST=Arizona/L=Nevada/O=RavenDB Test/OU=RavenDB test/CN=localhost/[email protected]" -addext "subjectAltName = DNS:localhost" | |
- run: openssl x509 -req -extensions ext -extfile cert/test_cert.conf -in certs/localhost.csr -CA certs/ca.crt -CAkey certs/ca.key -CAcreateserial -out certs/localhost.crt | |
- run: cat certs/localhost.key certs/localhost.crt > certs/java.pem | |
- run: openssl pkcs12 -passout pass:"" -export -out certs/server.pfx -inkey certs/localhost.key -in certs/localhost.crt | |
- run: sudo cp certs/ca.crt /usr/local/share/ca-certificates/ca.crt | |
- run: sudo update-ca-certificates | |
- name: Deploy server certificate | |
run: mkdir RavenDB/Server/certs && cp certs/server.pfx RavenDB/Server/certs/ | |
- name: Run Secured RDB | |
run: ./RavenDB/Server/Raven.Server -c $(realpath ./settings-secured.json) & | |
- name: Wait for server to run | |
run: while ! curl https://localhost:8081; do sleep 0.2; echo "Waiting for secured server to start..."; done | |
- name: Install library tools | |
run: composer install | |
- name: List unit tests | |
run: phpunit --list-tests | |
- name: Run unit tests | |
run: phpunit |