Skip to content

Commit

Permalink
Added windows ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MarhiievHE committed Dec 30, 2023
1 parent 4bab107 commit 11cb177
Showing 1 changed file with 38 additions and 14 deletions.
52 changes: 38 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Testing CI

on:
- pull_request
# - push
on: pull_request

jobs:
build:
Expand Down Expand Up @@ -33,21 +31,47 @@ jobs:
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Setup docker (on Windows)
- name: Setup pg (on Windows)
if: runner.os == 'windows'
run: |
Invoke-WebRequest -Uri https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe -OutFile jq.exe
.\jq.exe '. + {"experimental": true}' C:\ProgramData\Docker\config\daemon.json | Set-Content -Path C:\ProgramData\Docker\config\daemon.json
type C:\ProgramData\Docker\config\daemon.json
Restart-Service Docker
docker info
Invoke-WebRequest -Uri "https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?_gl=1*1h68n6z*_ga*MTE2MjkxMTYzMS4xNjk2MjYwNjc1*_ga_XJWPQMJYHQ*MTcwMzgwOTg0MS4yMi4xLjE3MDM4MTA1MzAuMjcuMC4w" -o ddi.exe
Start-Process 'ddi.exe' -Wait install
# dir "C:\ProgramData\Docker"
# .\DockerCli.exe -SwitchDaemon
# Get-ChildItem -Path "C:\ProgramData\Docker" -Filter "DockerCli.exe" -Recurse
echo "unix_socket_directories = ''" >> "$PGDATA/postgresql.conf"
echo "port = 5432" >> "$PGDATA/postgresql.conf"
$PG_BIN = "C:\Program Files\PostgreSQL\14\bin"
$env:PATH = "$PG_BIN;$env:PATH"
Write-Host "PATH=$env:PATH"
pg_ctl start
Start-Sleep -Seconds 15
cd database
bash setup.sh
- name: Setup redis (on Windows)
if: runner.os == 'windows'
run: |
$URL = "https://github.com/redis-windows/redis-windows/releases/download/7.0.14/Redis-7.0.14-Windows-x64-with-Service.tar.gz"
$outputFolder = "C:\redis"
if (-not (Test-Path $outputFolder)) {
New-Item -ItemType Directory -Path $outputFolder | Out-Null
}
Invoke-WebRequest -Uri $URL -OutFile "redis.tar.gz"
tar -xf "redis.tar.gz" -C $outputFolder
$innerFolder = Get-ChildItem -Path $outputFolder | Select-Object -First 1
Move-Item -Path "$outputFolder\$($innerFolder.Name)\*" -Destination $outputFolder -Force
Remove-Item -Path "$outputFolder\$($innerFolder.Name)" -Force
$REDIS_PATH=$outputFolder
Write-Host "REDIS_PATH=$REDIS_PATH"
cd $REDIS_PATH
dir
sc.exe create Redis binpath=C:\redis\RedisService.exe start= auto
net start Redis
- name: Start docker containers
if: runner.os != 'windows'
run: |
docker-compose -f test-docker-compose.yml up -d pg-example redis-example
sleep 10 # wait for database to be ready
Expand Down

0 comments on commit 11cb177

Please sign in to comment.