-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.33 KB
/
shell.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Shell
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
lint-shell-scripts:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run shfmt and shellcheck
uses: luizm/action-sh-checker@v0.8.0
env:
SHFMT_OPTS: -d -s -w -i 4 -ln bash
check-script-logic:
name: Check pkg:${{ matrix.pkg }} os:${{ matrix.os }}
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
pkg:
- all
- go
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.1'
cache: false
- name: Configure test repository
run: |
git clone https://github.com/xorcare/tornado
- name: Setup git user
working-directory: tornado
run: |
git config user.email "you@example.com"
git config user.name "Your Name"
- name: Zero exit code when use help flags
working-directory: tornado
run: |
../go-mod-bump.sh -h
../go-mod-bump.sh -help
- name: Zero exit code when module name is not set
working-directory: tornado
run: |
../go-mod-bump.sh
- name: Update dependencies when there is something to update
working-directory: tornado
run: |
git checkout --force --quiet 029fe5d254ab71c1e72444adcda808f5a494084d
../go-mod-bump.sh ${{ matrix.pkg }}
commit_count=$(git rev-list --count HEAD ^029fe5d254ab71c1e72444adcda808f5a494084d)
if [[ "$commit_count" == 0 ]]; then
echo "ERROR: No changes have been detected, but they must be exist"
exit 1
fi
git diff 029fe5d254ab71c1e72444adcda808f5a494084d
- name: Zero exit code when nothing to update
working-directory: tornado
run: |
git checkout --force --quiet 029fe5d254ab71c1e72444adcda808f5a494084d
../go-mod-bump.sh ${{ matrix.pkg }} # update
../go-mod-bump.sh ${{ matrix.pkg }} # nothing to update
- name: Zero exit code when no have direct modules
working-directory: tornado
run: |
git checkout --force --quiet 029fe5d254ab71c1e72444adcda808f5a494084d
../go-mod-bump.sh ${{ matrix.pkg }}