Skip to content

Commit 29ea012

Browse files
committed
Build CI in more OS targets
1 parent 5d81b6e commit 29ea012

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
11+
runs-on: ${{ matrix.os }}
1212

1313
strategy:
1414
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
1516
go-version: [1.23.x]
1617

1718
steps:
@@ -42,14 +43,27 @@ jobs:
4243
- name: Build
4344
run: go build -v ./...
4445

45-
- name: Build binary
46+
- name: Build binary (Unix)
47+
if: runner.os != 'Windows'
4648
run: go build -o grove .
4749

50+
- name: Build binary (Windows)
51+
if: runner.os == 'Windows'
52+
run: go build -o grove.exe .
53+
4854
- name: Test
4955
run: go test -v ./...
5056

51-
- name: Upload binary
57+
- name: Upload binary (Unix)
58+
if: runner.os != 'Windows'
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: grove-${{ runner.os }}
62+
path: grove
63+
64+
- name: Upload binary (Windows)
65+
if: runner.os == 'Windows'
5266
uses: actions/upload-artifact@v4
5367
with:
5468
name: grove-${{ runner.os }}
55-
path: grove
69+
path: grove.exe

internal/git/time_other.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !darwin && !linux
1+
//go:build !darwin && !linux && !windows
22

33
package git
44

internal/git/time_windows.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//go:build windows
2+
3+
package git
4+
5+
import (
6+
"os"
7+
"syscall"
8+
"time"
9+
)
10+
11+
func getCreatedTime(path string) (time.Time, error) {
12+
info, err := os.Stat(path)
13+
if err != nil {
14+
return time.Time{}, err
15+
}
16+
17+
// Windows has creation time in the file info
18+
if stat, ok := info.Sys().(*syscall.Win32FileAttributeData); ok {
19+
return time.Unix(0, stat.CreationTime.Nanoseconds()), nil
20+
}
21+
22+
return info.ModTime(), nil
23+
}

0 commit comments

Comments
 (0)