File tree Expand file tree Collapse file tree 15 files changed +962
-44
lines changed Expand file tree Collapse file tree 15 files changed +962
-44
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ @error () { echo " ${@ } " >&2 ; }
6
+ @fatal () { @error " ${@ } " && exit 1; }
7
+
8
+ # TODO:implement
9
+ echo not implemented yet
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ @error () { echo " ${@ } " >&2 ; }
6
+ @fatal () { @error " ${@ } " && exit 1; }
7
+
8
+ # TODO:implement
9
+ echo not implemented yet
Original file line number Diff line number Diff line change 1
1
name : Continuous integration (godownloader)
2
2
3
3
on :
4
- workflow_dispatch :
5
- inputs :
6
- reason :
7
- description : The reason for dispatching it manually.
8
- type : string
9
- default : manual healthcheck
10
- required : true
11
-
12
4
push :
13
5
branches : [ main ]
14
6
paths :
19
11
schedule :
20
12
- cron : ' 0 7 * * 1' # at 07:00 on Monday, UTC
21
13
14
+ workflow_dispatch :
15
+ inputs :
16
+ reason :
17
+ description : The reason for dispatching it manually.
18
+ type : string
19
+ default : manual healthcheck
20
+ required : true
21
+
22
22
jobs :
23
23
check :
24
24
name : Checking
Original file line number Diff line number Diff line change 1
1
name : Continuous integration (goimports)
2
2
3
3
on :
4
- workflow_dispatch :
5
- inputs :
6
- reason :
7
- description : The reason for dispatching it manually.
8
- type : string
9
- default : manual healthcheck
10
- required : true
11
-
12
4
push :
13
5
branches : [ main ]
14
6
paths :
19
11
schedule :
20
12
- cron : ' 0 7 * * 1' # at 07:00 on Monday, UTC
21
13
14
+ workflow_dispatch :
15
+ inputs :
16
+ reason :
17
+ description : The reason for dispatching it manually.
18
+ type : string
19
+ default : manual healthcheck
20
+ required : true
21
+
22
22
jobs :
23
23
check :
24
24
name : Checking
Original file line number Diff line number Diff line change 1
1
name : Continuous integration (golangci-lint)
2
2
3
3
on :
4
- workflow_dispatch :
5
- inputs :
6
- reason :
7
- description : The reason for dispatching it manually.
8
- type : string
9
- default : manual healthcheck
10
- required : true
11
-
12
4
push :
13
5
branches : [ main ]
14
6
paths :
19
11
schedule :
20
12
- cron : ' 0 7 * * 1' # at 07:00 on Monday, UTC
21
13
14
+ workflow_dispatch :
15
+ inputs :
16
+ reason :
17
+ description : The reason for dispatching it manually.
18
+ type : string
19
+ default : manual healthcheck
20
+ required : true
21
+
22
22
jobs :
23
23
check :
24
24
name : Checking
Original file line number Diff line number Diff line change 1
1
name : Continuous integration (maintainer)
2
2
3
3
on :
4
- workflow_dispatch :
5
- inputs :
6
- reason :
7
- description : The reason for dispatching it manually.
8
- type : string
9
- default : manual healthcheck
10
- required : true
11
-
12
4
push :
13
5
branches : [ main ]
14
6
paths :
19
11
schedule :
20
12
- cron : ' 0 7 * * 1' # at 07:00 on Monday, UTC
21
13
14
+ workflow_dispatch :
15
+ inputs :
16
+ reason :
17
+ description : The reason for dispatching it manually.
18
+ type : string
19
+ default : manual healthcheck
20
+ required : true
21
+
22
22
jobs :
23
23
check :
24
24
name : Checking
Original file line number Diff line number Diff line change
1
+ name : Continuous integration (service template)
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ paths :
7
+ - ' .github/actions/check/service.bash'
8
+ - ' .github/workflows/ci.service.yml'
9
+ - ' dist/service'
10
+
11
+ schedule :
12
+ - cron : ' 0 7 * * 1' # at 07:00 on Monday, UTC
13
+
14
+ workflow_dispatch :
15
+ inputs :
16
+ reason :
17
+ description : The reason for dispatching it manually.
18
+ type : string
19
+ default : manual healthcheck
20
+ required : true
21
+
22
+ jobs :
23
+ check :
24
+ name : Checking
25
+ runs-on : ubuntu-latest
26
+
27
+ steps :
28
+ - name : Checkout the repository
29
+ uses : actions/checkout@v3
30
+ with : { fetch-depth: 0 }
31
+
32
+ - name : Check consistency
33
+ uses : ./.github/actions/check
34
+ with : { script: service.bash }
35
+
36
+ notify :
37
+ name : Notifying
38
+ needs : [ check ]
39
+ runs-on : ubuntu-latest
40
+ if : failure() || success()
41
+
42
+ steps :
43
+ - name : Checkout the repository
44
+ uses : actions/checkout@v3
45
+ with : { fetch-depth: 0 }
46
+
47
+ - name : Send notification
48
+ uses : ./.github/actions/notify
49
+ continue-on-error : true
50
+ with :
51
+ channel : ${{ secrets.SLACK_WEBHOOK }}
52
+ success : ${{ ! contains(needs.*.result, 'failure') }}
Original file line number Diff line number Diff line change
1
+ name : Continuous integration (tool template)
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ paths :
7
+ - ' .github/actions/check/tool.bash'
8
+ - ' .github/workflows/ci.tool.yml'
9
+ - ' dist/tool'
10
+
11
+ schedule :
12
+ - cron : ' 0 7 * * 1' # at 07:00 on Monday, UTC
13
+
14
+ workflow_dispatch :
15
+ inputs :
16
+ reason :
17
+ description : The reason for dispatching it manually.
18
+ type : string
19
+ default : manual healthcheck
20
+ required : true
21
+
22
+ jobs :
23
+ check :
24
+ name : Checking
25
+ runs-on : ubuntu-latest
26
+
27
+ steps :
28
+ - name : Checkout the repository
29
+ uses : actions/checkout@v3
30
+ with : { fetch-depth: 0 }
31
+
32
+ - name : Check consistency
33
+ uses : ./.github/actions/check
34
+ with : { script: tool.bash }
35
+
36
+ notify :
37
+ name : Notifying
38
+ needs : [ check ]
39
+ runs-on : ubuntu-latest
40
+ if : failure() || success()
41
+
42
+ steps :
43
+ - name : Checkout the repository
44
+ uses : actions/checkout@v3
45
+ with : { fetch-depth: 0 }
46
+
47
+ - name : Send notification
48
+ uses : ./.github/actions/notify
49
+ continue-on-error : true
50
+ with :
51
+ channel : ${{ secrets.SLACK_WEBHOOK }}
52
+ success : ${{ ! contains(needs.*.result, 'failure') }}
Original file line number Diff line number Diff line change 16
16
- Continuous integration (goimports)
17
17
- Continuous integration (golangci-lint)
18
18
- Continuous integration (maintainer)
19
+ - Continuous integration (service template)
20
+ - Continuous integration (tool template)
19
21
- Workflow runs cleanup
20
22
default : Workflow runs cleanup
21
23
required : true
44
46
dry_run : ${{ fromJSON('["", "true"]')[github.event.inputs.dry_run == 'true'] }}
45
47
retain_days : 0
46
48
keep_minimum_runs : 0
49
+ - name : Cleanup workflow runs
50
+ run : |
51
+ gh run list \
52
+ -R '${{ github.repository }}' \
53
+ --status completed \
54
+ --limit 100 \
55
+ --json databaseId \
56
+ --jq '.[] | .databaseId' |
57
+ xargs -n1 --no-run-if-empty gh run delete -R '${{ github.repository }}'
58
+ env :
59
+ GITHUB_TOKEN : ${{ github.token }}
60
+ if : github.event.inputs.pattern == 'All'
47
61
48
62
notify :
49
63
name : Notifying
Original file line number Diff line number Diff line change @@ -57,6 +57,31 @@ golangci-lint version
57
57
[ golangci-lint ] : https://golangci-lint.octolab.org/
58
58
59
59
60
+ ### 🧩 [ go-service] [ ]
61
+
62
+ ``` bash
63
+ curl -sSfL https://install.octolab.org/service | sh -s -- -b /usr/local/bin
64
+ server help
65
+ server version
66
+
67
+ serverctl help
68
+ serverctl version
69
+ ```
70
+
71
+ [ go-service ] : https://go-service.octolab.org/
72
+
73
+
74
+ ### 🧩 [ go-tool] [ ]
75
+
76
+ ``` bash
77
+ curl -sSfL https://install.octolab.org/tool | sh -s -- -b /usr/local/bin
78
+ tool help
79
+ tool version
80
+ ```
81
+
82
+ [ go-tool ] : https://go-tool.octolab.org/
83
+
84
+
60
85
### 👨🔧 [ maintainer] [ ]
61
86
62
87
``` bash
Original file line number Diff line number Diff line change @@ -7,12 +7,13 @@ set -euo pipefail
7
7
exit 1
8
8
}
9
9
10
+ root=$( git rev-parse --show-toplevel)
10
11
include=(
11
- bin/lib/utils/* .bash
12
- bin/lib/git/* .bash
13
- bin/lib/tools/* .bash
14
- bin/lib/config/* .bash
15
- bin/lib/main .bash
12
+ " ${root} " / bin/lib/utils/* .bash
13
+ " ${root} " / bin/lib/git/* .bash
14
+ " ${root} " / bin/lib/tools/* .bash
15
+ " ${root} " / bin/lib/config/* .bash
16
+ " ${root} " / bin/lib/* .bash
16
17
)
17
18
18
19
for script in " ${include[@]} " ; do
Original file line number Diff line number Diff line change @@ -13,18 +13,14 @@ config['dryrun']=false
13
13
case " ${arg} " in
14
14
-d | --dry-run)
15
15
config[' dryrun' ]=true
16
-
17
16
config[' shift' ]=$(( config['shift'] + 1 ))
18
17
shift
19
18
;;
20
-
21
19
--trace)
22
20
set -x
23
-
24
21
config[' shift' ]=$(( config['shift'] + 1 ))
25
22
shift
26
23
;;
27
-
28
24
* ) break ;;
29
25
esac
30
26
done
Original file line number Diff line number Diff line change @@ -6,15 +6,27 @@ if [[ ":${PATH}:" != *":${_BINPATH}:"* ]]; then
6
6
export PATH=" ${_BINPATH} :${PATH} "
7
7
fi
8
8
[ -d " ${_BINPATH} " ] || mkdir -p " ${_BINPATH} "
9
+ export GOBIN=" ${_BINPATH} "
9
10
10
- # Example: run @install dist/vendor/gum
11
- # Example: run @install dist/vendor/gum ./bin/{os}/{arch}
12
- # Example: run @install https://install.octolab.org/vendor/gum
11
+ # Example: run @install path/to/gum
12
+ # Example: run @install vendor/gum ./bin/{os}/{arch}
13
13
# Example: run @install https://install.octolab.org/vendor/gum ./bin/{os}/{arch}
14
14
@install () {
15
15
local script=${1} path=${2:- ${_BINPATH} }
16
16
path=${path/ ' {os}' / $(@ os)}
17
17
path=${path/ ' {arch}' / $(@ arch)}
18
+
19
+ if [[ " ${script} " =~ ^vendor/ ]]; then
20
+ script=" https://install.octolab.org/${script} "
21
+ fi
22
+ if [[ ! " ${script} " =~ ^https:// ]] && [ ! -f " ${script} " ]; then
23
+ script=" https://install.octolab.org/${script} "
24
+ fi
25
+
26
+ [[ " ${script} " =~ ^https:// ]] && [ \
27
+ " $( curl -s -o /dev/null -w ' %{http_code}' --head " ${script} " ) " -eq " 200" \
28
+ ]
29
+
18
30
if [[ " ${script} " =~ ^https://install.octolab.org/vendor ]]; then
19
31
curl -sSfL " ${script} " | bash -s -- " ${path} "
20
32
return $?
You can’t perform that action at this time.
0 commit comments