Skip to content

Commit

Permalink
Fix Windows builds and test they compile
Browse files Browse the repository at this point in the history
  • Loading branch information
hifi committed Dec 15, 2023
1 parent 38a5a22 commit e86da01
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,31 @@ jobs:
- uses: pre-commit/[email protected]

build-windows:
name: Windows Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: windows-go-${{ hashFiles('**/go.sum') }}
restore-keys: windows-go-

- run: sudo apt-get install -y mingw-w64

- run: |
GOARCH=386 CC=i686-w64-mingw32-gcc go build ./cmd/litestream/
GOARCH=amd64 CC=x86_64-w64-mingw32-gcc go build ./cmd/litestream/
env:
CGO_ENABLED: "1"
GOOS: windows
build:
name: Build & Unit Test
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion cmd/litestream/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (s *windowsService) Execute(args []string, r <-chan svc.ChangeRequest, stat
}

// Execute replication command.
if err := c.Run(s.ctx); err != nil {
if err := c.Run(); err != nil {
slog.Error("cannot replicate", "error", err)
statusCh <- svc.Status{State: svc.StopPending}
return true, 2
Expand Down

0 comments on commit e86da01

Please sign in to comment.