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 6bf8de5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- run: |
go install golang.org/x/tools/cmd/goimports@latest
Expand All @@ -29,21 +28,36 @@ jobs:
- uses: pre-commit/[email protected]

build:
name: Build & Unit Test
build-windows:
name: Build Windows
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install -y mingw-w64

- uses: actions/checkout@v4

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

- uses: actions/cache@v2
- run: |
go build ./cmd/litestream/
file ./litestream.exe
env:
CGO_ENABLED: "1"
GOOS: windows
GOARCH: amd64
CC: x86_64-w64-mingw32-gcc
build:
name: Build & Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
path: ~/go/pkg/mod
key: ${{ inputs.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ inputs.os }}-go-
go-version: ${{ env.GO_VERSION }}

- run: go env

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 6bf8de5

Please sign in to comment.