Replace rand with random_int and remove fallback try-catch.
#10
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
| name: e2e-test-editing-chrome | |
| on: | |
| push: | |
| branches: | |
| - "*" | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| run: | |
| runs-on: ${{ matrix.operating-system }} | |
| strategy: | |
| matrix: | |
| operating-system: [ 'ubuntu-latest' ] | |
| # operating-system: [ubuntu-latest, macos-latest, windows-latest] | |
| php-versions: [ '8.2', '8.3', '8.4','8.5' ] | |
| name: End-to-End Test for Chrome on ${{ matrix.operating-system }} with PHP ${{ matrix.php-versions }} | |
| services: | |
| mysql: # https://qiita.com/sayama0402/items/e863ffb597ce87bf2e2f | |
| image: mysql:8.0 | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_ROOT_PASSWORD: EeLeBui7%Eesa4oto | |
| options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10 | |
| postgres: | |
| image: postgres:16 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: EeLeBui7%Eesa4oto | |
| POSTGRES_DB: test_db | |
| # volumes: | |
| # - /home/runner/work/INTER-Mediator/INTER-Mediator/dist-docs/sample_schema_pgsql.sql:/docker-entrypoint-initdb.d/sample_schema_pgsql.sql | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install PHP | |
| uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2.35.5 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| extensions: intl #optional | |
| ini-values: "post_max_size=256M" #optional | |
| - name: Print Env Varialbles | |
| run: printenv | |
| - name: PHP Module Checking | |
| run: php -m | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Update dependencies | |
| run: composer update | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Setup Samples | |
| run: | | |
| git clone https://github.com/INTER-Mediator/INTER-Mediator_Samples samples | |
| mkdir -p ./samples/vendor/inter-mediator | |
| cd ./samples/vendor/inter-mediator | |
| ln -s ../../../ inter-mediator | |
| - name: Setup MySQL | |
| run: | | |
| mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto < ./dist-docs/sample_schema_mysql.sql | |
| mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto < ./spec/run/additionals_mysql.sql | |
| mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto -e "CREATE USER IF NOT EXISTS 'web'@'%' IDENTIFIED BY 'password';" | |
| mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto -e "GRANT SELECT, INSERT, DELETE, UPDATE ON TABLE test_db.* TO 'web'@'%';" | |
| mysql -h 127.0.0.1 --port 3306 -u root --password=EeLeBui7%Eesa4oto -e "GRANT SHOW VIEW ON TABLE test_db.* TO 'web'@'%';" | |
| - name: Setup PostgreSQL | |
| run: | | |
| psql --quiet postgresql://postgres:EeLeBui7%25Eesa4oto@127.0.0.1:5432/test_db < ./dist-docs/sample_schema_pgsql.sql | |
| psql --quiet postgresql://postgres:EeLeBui7%25Eesa4oto@127.0.0.1:5432/test_db < ./spec/run/additionals_postgresql.sql | |
| # - name: Check MySQL | |
| # run: mysql -h 127.0.0.1 --port 3306 -u web --password=password -e "select * from person;" test_db | |
| - name: Setup SQLite | |
| run: | | |
| touch sample.sq3 | |
| sqlite3 sample.sq3 < ./dist-docs/sample_schema_sqlite.sql | |
| sqlite3 sample.sq3 < ./spec/run/additionals_sqlite.sql | |
| chmod 777 sample.sq3 | |
| # chown www-data sample.sq3 | |
| - name: Modify params.php file | |
| run: | | |
| echo "" >> params.php | |
| echo "\$defaultTimezone = 'UTC';" >> params.php | |
| echo "\$followingTimezones = true;" >> params.php | |
| echo "\$fixed2FACode = '5555';" >> params.php | |
| echo "" >> params.php | |
| # E2E test with WebdriverIO | |
| - name: Setup Headless Chrome | |
| uses: browser-actions/setup-chromium@latest | |
| with: | |
| chrome-version: 126 | |
| install-chromedriver: true | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 | |
| with: | |
| version: 10.17 | |
| - name: Setup WebdriverIO | |
| run: cd spec/run; pnpm config list; pnpm install --frozen-lockfile | |
| - name: Decide port number | |
| id: set-ghport | |
| run: | | |
| GHPORTNUM=`expr 9000 + \`echo -n ${{ matrix.php-versions }} | sed -e "s/\.//g"\`` | |
| echo "GHPORTNUM=${GHPORTNUM}" >> $GITHUB_OUTPUT | |
| - name: Boot the web server with php server mode | |
| run: | | |
| php -S "localhost:${{ steps.set-ghport.outputs.GHPORTNUM }}" & | |
| for i in $(seq 1 60); do | |
| curl -fsS "http://localhost:${{ steps.set-ghport.outputs.GHPORTNUM }}/" >/dev/null && break | |
| sleep 1 | |
| done | |
| - name: Starting End-to-End Tests with Google Chrome | |
| env: | |
| IM_BASEURL: http://localhost:${{ steps.set-ghport.outputs.GHPORTNUM }}/ | |
| run: cd spec/run;npx wdio wdio-editing-chrome.conf.js | |
| # - name: Modify params.php file for clinet-sync | |
| # run: | | |
| # GHPORTNUM=`expr 33451 + \`echo -n ${{ matrix.php-versions }} | sed -e "s/\.//g"\`` | |
| # echo "" >> params.php | |
| # echo "$notUseServiceServer = false;" >> params.php | |
| # echo "$activateClientService = true; " >> params.php | |
| # echo "$serviceServerProtocol = \"ws\";" >> params.php | |
| # echo "$serviceServerHost = \"localhost\";" >> params.php | |
| # echo "$serviceServerPort = \"${GHPORTNUM}\";" >> params.php | |
| # echo "$serviceServerConnect = \"http://localhost\";" >> params.php | |
| # echo "$bootWithInstalledNode = false;" >> params.php | |
| # echo "$preventSSAutoBoot = false;" >> params.php | |
| # echo "$backSeconds = 3600 * 24 * 2;" >> params.php | |
| # echo "$foreverLog = '/tmp/nodemon.log';" >> params.php | |
| # echo "" >> params.php | |
| # | |
| # - name: Starting End-to-End Tests about Clinet Synchronization with Google Chrome | |
| # run: cd spec/run;npx wdio wdio-sync-chrome.conf.js |