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