File tree Expand file tree Collapse file tree 5 files changed +98
-4
lines changed Expand file tree Collapse file tree 5 files changed +98
-4
lines changed Original file line number Diff line number Diff line change
1
+ name : back-compat PR
2
+
3
+ on :
4
+ pull_request :
5
+ paths :
6
+ - " go.*"
7
+ - " **/*.go"
8
+ - " .github/workflows/*.yml"
9
+
10
+ permissions :
11
+ contents : read
12
+
13
+ env :
14
+ GO_VERSION : ' 1.22.5'
15
+
16
+ jobs :
17
+ check-back-compat :
18
+ name : build
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ - uses : actions/checkout@v4
22
+ - name : Set up Go
23
+ uses : actions/setup-go@v5
24
+ with :
25
+ go-version : ${{ env.GO_VERSION }}
26
+ - name : build head
27
+ run : |
28
+ go build -o omm_head
29
+ cp omm_head /var/tmp
30
+ - uses : actions/checkout@v4
31
+ with :
32
+ ref : main
33
+ - name : build main
34
+ run : |
35
+ go build -o omm_main
36
+ cp omm_main /var/tmp
37
+ - name : Run last version
38
+ run : |
39
+ /var/tmp/omm_main --db-path=/var/tmp/throwaway.db 'test: a task from main'
40
+ - name : Run current version
41
+ run : |
42
+ /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD'
43
+ /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks
Original file line number Diff line number Diff line change
1
+ name : back-compat
2
+
3
+ on :
4
+ push :
5
+ branches : [ "main" ]
6
+
7
+ permissions :
8
+ contents : read
9
+
10
+ env :
11
+ GO_VERSION : ' 1.22.5'
12
+
13
+ jobs :
14
+ check-back-compat :
15
+ name : build
16
+ runs-on : ubuntu-latest
17
+ steps :
18
+ - uses : actions/checkout@v4
19
+ with :
20
+ fetch-depth : 2
21
+ - name : Set up Go
22
+ uses : actions/setup-go@v5
23
+ with :
24
+ go-version : ${{ env.GO_VERSION }}
25
+ - name : build head
26
+ run : |
27
+ go build -o omm_head
28
+ cp omm_head /var/tmp
29
+ rm omm_head
30
+ - run : git checkout HEAD~1
31
+ - name : build main
32
+ run : |
33
+ go build -o omm_prev
34
+ cp omm_prev /var/tmp
35
+ - name : Run last version
36
+ run : |
37
+ /var/tmp/omm_prev --db-path=/var/tmp/throwaway.db 'test: a task from previous commit'
38
+ - name : Run current version
39
+ run : |
40
+ /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from main HEAD'
41
+ /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks
Original file line number Diff line number Diff line change 33
33
uses : golangci/golangci-lint-action@v6
34
34
with :
35
35
version : v1.58
36
+ - name : run omm
37
+ run : |
38
+ go build .
39
+ ./omm 'test: a task'
40
+ ./omm tasks
Original file line number Diff line number Diff line change 50
50
updateContents string
51
51
)
52
52
53
- func Execute (version string ) {
53
+ func Execute (version string ) error {
54
54
rootCmd , err := NewRootCommand ()
55
55
56
56
rootCmd .Version = version
@@ -59,7 +59,7 @@ func Execute(version string) {
59
59
os .Exit (1 )
60
60
}
61
61
62
- _ = rootCmd .Execute ()
62
+ return rootCmd .Execute ()
63
63
}
64
64
65
65
func setupDB (dbPathFull string ) (* sql.DB , error ) {
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
- "github.com/dhth/omm/cmd "
4
+ "os "
5
5
"runtime/debug"
6
+
7
+ "github.com/dhth/omm/cmd"
6
8
)
7
9
8
10
var (
@@ -17,5 +19,8 @@ func main() {
17
19
v = info .Main .Version
18
20
}
19
21
}
20
- cmd .Execute (v )
22
+ err := cmd .Execute (v )
23
+ if err != nil {
24
+ os .Exit (1 )
25
+ }
21
26
}
You can’t perform that action at this time.
0 commit comments