From 4b14553115abf17f7e68577a032e25f2733cacb0 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Thu, 14 Sep 2023 10:47:24 +0900 Subject: [PATCH] Fix authentication method on PostgreSQL for Windows --- .github/workflows/main.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2318ae4c7f..a8bed1514f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -180,12 +180,19 @@ jobs: - name: Start PostgreSQL on Windows # see https://www.cybertec-postgresql.com/en/postgresql-github-actions-continuous-integration/ run: | + echo $env:PGBIN >> $Env:GITHUB_PATH $pgService = Get-Service -Name postgresql* Set-Service -InputObject $pgService -Status running -StartupType automatic Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru $env:PGPASSWORD = 'root' - & $env:PGBIN\createdb --owner=postgres eccube_db - echo $env:PGBIN >> $Env:GITHUB_PATH + (Get-Content $env:PGDATA\postgresql.conf) | foreach { $_ -replace "scram-sha-256","md5" } | Set-Content $env:PGDATA\postgresql.conf + (Get-Content $env:PGDATA\pg_hba.conf) | foreach { $_ -replace "scram-sha-256","md5" } | Set-Content $env:PGDATA\pg_hba.conf + Restart-Service -InputObject $pgService -Force + Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru + & $env:PGBIN\createuser -U postgres -d -R eccube_db_user + & $env:PGBIN\psql -U postgres -c "ALTER role eccube_db_user with password 'password';" postgres + & $env:PGBIN\psql -U postgres -c "select rolname,rolpassword from pg_authid;" postgres + & $env:PGBIN\createdb --owner=eccube_db_user eccube_db - name: Setup PHP uses: nanasess/setup-php@master @@ -195,8 +202,8 @@ jobs: - name: Setup to EC-CUBE env: DB: pgsql - DBUSER: postgres - DBPASS: root + DBUSER: eccube_db_user + DBPASS: password DBNAME: eccube_db DBPORT: 5432 DBSERVER: 127.0.0.1