You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@casbin.apache.org by hs...@apache.org on 2026/06/27 04:27:03 UTC

(casbin-sqlx-adapter) branch master updated (0ff52c3 -> 55e4987)

This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-sqlx-adapter.git


 discard 0ff52c3  fix(ci): use pre-installed PostgreSQL and generate sqlite3.def on Windows
     new 55e4987  fix(ci): use pre-installed PostgreSQL and generate sqlite3.def on Windows

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0ff52c3)
            \
             N -- N -- N   refs/heads/master (55e4987)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org


(casbin-sqlx-adapter) 01/01: fix(ci): use pre-installed PostgreSQL and generate sqlite3.def on Windows

Posted by hs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-sqlx-adapter.git

commit 55e49871a536ad8fb7806e6d0b59fdf968612e40
Author: Yang Luo <hs...@gmail.com>
AuthorDate: Sat Jun 27 11:57:28 2026 +0800

    fix(ci): use pre-installed PostgreSQL and generate sqlite3.def on Windows
---
 .github/workflows/ci.yml | 55 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 40 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7041c71..216c3d8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -75,26 +75,51 @@ jobs:
 
       - name: Setup PostgreSQL & MySQL & SQLite (for windows)
         if: matrix.os == 'windows-latest'
-        shell: cmd
+        shell: pwsh
         run: |
-          choco install postgresql11 --force --params '/Password:root'
-          choco install mysql sqlite
-          "C:\Program Files\PostgreSQL\11\bin\createuser" casbin_rs
-          "C:\Program Files\PostgreSQL\11\bin\createdb" casbin
-          "C:\Program Files\PostgreSQL\11\bin\psql" -c "alter user casbin_rs with encrypted password 'casbin_rs'; grant all privileges on database casbin to casbin_rs;"
-          "C:\tools\mysql\current\bin\mysql" -e "create user 'casbin_rs'@'localhost' identified by 'casbin_rs'; create database casbin; grant all on `casbin`.* to 'casbin_rs'@'localhost';" -uroot
-          cd /D C:\ProgramData\chocolatey\lib\SQLite\tools
-          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
-          lib /machine:x64 /def:sqlite3.def /out:sqlite3.lib
+          # PostgreSQL - use the pre-installed binaries, init a fresh data dir
+          $pgDir = (Get-ChildItem 'C:\Program Files\PostgreSQL' -Directory |
+                    Sort-Object Name -Descending | Select-Object -First 1).FullName
+          $pgBin = "$pgDir\bin"
+          $pgData = "C:\pgdata"
+          & "$pgBin\initdb" -D "$pgData" -U postgres -E UTF8 --auth=trust
+          & "$pgBin\pg_ctl" start -D "$pgData" -w -t 60
+          & "$pgBin\psql" -U postgres -c "CREATE USER casbin_rs WITH ENCRYPTED PASSWORD 'casbin_rs';"
+          & "$pgBin\psql" -U postgres -c "CREATE DATABASE casbin OWNER casbin_rs;"
+          & "$pgBin\psql" -U postgres -d casbin -c "GRANT USAGE, CREATE ON SCHEMA public TO casbin_rs;"
+          & "$pgBin\psql" -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE casbin TO casbin_rs;"
+          echo "PG_DIR=$pgDir" >> $env:GITHUB_ENV
+
+          # MySQL - install, initialize (no root password), then start as a service
+          choco install mysql -y
+          & 'C:\tools\mysql\current\bin\mysqld' --initialize-insecure --user=root
+          & 'C:\tools\mysql\current\bin\mysqld' --install MySQLService
+          Start-Service MySQLService
+          Start-Sleep -Seconds 10
+          & 'C:\tools\mysql\current\bin\mysql' -uroot --connect-expired-password -e "CREATE USER 'casbin_rs'@'localhost' IDENTIFIED BY 'casbin_rs'; CREATE DATABASE casbin; GRANT ALL ON ``casbin``.* TO 'casbin_rs'@'localhost'; FLUSH PRIVILEGES;"
+
+          # SQLite - install, then build sqlite3.lib from sqlite3.dll via generated .def
+          choco install sqlite -y
+          $sqliteDir = 'C:\ProgramData\chocolatey\lib\SQLite\tools'
+          $vcvars = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat'
+          # Generate exports list using dumpbin (needs vcvars in PATH)
+          cmd /c "`"$vcvars`" && dumpbin /exports `"$sqliteDir\sqlite3.dll`" > `"$sqliteDir\exports.txt`""
+          # Parse exports and write .def file
+          $content = Get-Content "$sqliteDir\exports.txt" -Raw
+          $names = [regex]::Matches($content, '^\s+\d+\s+[0-9A-Fa-f]+\s+[0-9A-Fa-f]+\s+(\w+)', 'Multiline') |
+                   ForEach-Object { $_.Groups[1].Value }
+          (@("LIBRARY sqlite3", "EXPORTS") + $names) | Out-File "$sqliteDir\sqlite3.def" -Encoding ASCII
+          # Build sqlite3.lib
+          cmd /c "`"$vcvars`" && lib /machine:x64 /def:`"$sqliteDir\sqlite3.def`" /out:`"$sqliteDir\sqlite3.lib`""
 
       - name: Set environment variables (for windows)
         if: matrix.os == 'windows-latest'
-        shell: bash
+        shell: pwsh
         run: |
-          echo "C:\Program Files\PostgreSQL\11\bin" >> $GITHUB_PATH
-          echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\11\lib" >> $GITHUB_ENV
-          echo "MYSQLCLIENT_LIB_DIR=C:\tools\mysql\current\lib" >> $GITHUB_ENV
-          echo "SQLITE3_LIB_DIR=C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_ENV
+          echo "$env:PG_DIR\bin" >> $env:GITHUB_PATH
+          echo "PQ_LIB_DIR=$env:PG_DIR\lib" >> $env:GITHUB_ENV
+          echo "MYSQLCLIENT_LIB_DIR=C:\tools\mysql\current\lib" >> $env:GITHUB_ENV
+          echo "SQLITE3_LIB_DIR=C:\ProgramData\chocolatey\lib\SQLite\tools" >> $env:GITHUB_ENV
 
       - name: Create SQLite DB
         run: |


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org