fix: ci #386
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: Database Test | |
on: | |
push: | |
paths-ignore: | |
- '**/*.md' | |
pull_request: | |
paths-ignore: | |
- '**/*.md' | |
jobs: | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: Start MSSQL | |
run: | | |
choco install sql-server-express --no-progress -y | |
sc qc 'MSSQL$SQLEXPRESS' | |
# https://learn.microsoft.com/en-us/sql/powershell/how-to-enable-tcp-sqlps | |
- name: Enable the TCP protocol on MSSQL$SQLEXPRESS | |
run: | | |
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SqlWmiManagement') | |
$ManagedComputer = New-Object -TypeName 'Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer' | |
$ManagedComputer | |
$ServerInstance = $ManagedComputer.ServerInstances['SQLEXPRESS'] | |
$Tcp = $ServerInstance.ServerProtocols['Tcp'] | |
$Tcp.IsEnabled = $True | |
$IP4 = $Tcp.IPAddresses['IP4'] | |
$IP4.IPAddressProperties['Enabled'].Value = $True | |
$IP4.IPAddressProperties['TcpPort'].Value = '1433' | |
$IPAll = $Tcp.IPAddresses['IPALL'] | |
$IPAll.IPAddressProperties['TcpPort'].Value = '1433' | |
$Tcp.Alter() | |
$Tcp.Refresh() | |
$Tcp | |
$Np = $ServerInstance.ServerProtocols['Np'] | |
$Np.IsEnabled = $True | |
$Np.Alter() | |
$Np.Refresh() | |
$Np | |
sqlcmd -S '.\SQLEXPRESS' -Q "ALTER LOGIN [sa] WITH PASSWORD = '$Env:COMPUTERNAME'" | |
sqlcmd -S '.\SQLEXPRESS' -Q "ALTER LOGIN [sa] ENABLE" | |
Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL*\MSSQLServer\' | |
Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL*\MSSQLServer\' -Name LoginMode -Value 2 | |
Restart-Service -Name 'MSSQL$SQLEXPRESS' | |
echo "SQLCMDPASSWORD=$Env:COMPUTERNAME" >> $Env:GITHUB_ENV | |
- name: Start PostgreSQL | |
run: | | |
sc config postgresql-x64-14 start= demand | |
sc start postgresql-x64-14 | |
- name: Start MySQL | |
run: | | |
mysqld --initialize-insecure | |
mysqld --install | |
sc start MySQL | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: chmod -R 777 * | |
run: chmod -R 777 * | |
- name: Init gradle project | |
run: ./gradlew clean --scan | |
- name: Create Database and Account | |
run: | | |
& $Env:PGBIN/createdb -U postgres mirai | |
mysqladmin -uroot create mirai | |
mysqladmin -uroot password root | |
sqlcmd -S tcp:localhost\SQLEXPRESS,1433 -Q "CREATE DATABASE mirai" -U sa | |
- name: Assemble | |
run: ./gradlew assemble --scan | |
- name: SqliteTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.SqliteTest" --scan --info | |
- name: H2Test | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.H2Test" --scan --info | |
- name: MariaDBTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MariaDBTest" --scan --info | |
- name: MySqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MySqlTest" --scan --info | |
- name: PostgreSqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.PostgreSqlTest" --scan --info | |
- name: MSSqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MSSqlTest" --scan --info | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Start PostgreSQL | |
run: | | |
brew install postgresql@14 | |
brew info postgresql@14 | |
brew services start postgresql@14 -v | |
tail -n 100 /usr/local/var/log/postgres*.log | |
env: | |
PGUSER: postgres | |
PGDATABASE: postgres | |
- name: Start MySQL | |
run: | | |
brew install mysql | |
brew info mysql | |
brew services restart mysql -v | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: chmod -R 777 * | |
run: chmod -R 777 * | |
- name: Init gradle project | |
run: ./gradlew clean --scan | |
- name: Set Database User | |
run: | | |
createuser -U runner -s postgres | |
createdb mirai | |
psql -c "ALTER USER postgres PASSWORD 'root';" | |
mysqladmin -uroot create mirai | |
mysqladmin -uroot password root | |
env: | |
PGUSER: postgres | |
PGDATABASE: postgres | |
- name: Assemble | |
run: ./gradlew assemble --scan | |
- name: SqliteTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.SqliteTest" --scan --info | |
- name: H2Test | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.H2Test" --scan --info | |
- name: MariaDBTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MariaDBTest" --scan --info | |
- name: MySqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MySqlTest" --scan --info | |
- name: PostgreSqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.PostgreSqlTest" --scan --info | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Start PostgreSql | |
run: | | |
sudo systemctl start postgresql | |
sudo -u postgres createdb mirai | |
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'root';" | |
- name: Start MySQL | |
run: | | |
sudo systemctl start mysql.service | |
mysqladmin -u root -proot create mirai | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: chmod -R 777 * | |
run: chmod -R 777 * | |
- name: Init gradle project | |
run: ./gradlew clean --scan | |
- name: Assemble | |
run: ./gradlew assemble --scan | |
- name: SqliteTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.SqliteTest" --scan --info | |
- name: H2Test | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.H2Test" --scan --info | |
- name: MariaDBTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MariaDBTest" --scan --info | |
- name: MySqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.MySqlTest" --scan --info | |
- name: PostgreSqlTest | |
run: ./gradlew test --tests "xyz.cssxsh.mirai.hibernate.entry.PostgreSqlTest" --scan --info | |
build: | |
needs: [ windows, macos, linux ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: chmod -R 777 * | |
run: chmod -R 777 * | |
- name: Build Plugin | |
run: ./gradlew buildPlugin | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ github.run_id }} | |
path: build/mirai/* |