Add workflow for checking the script #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Shell | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
check-shell-scripts: | |
name: Check | |
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 the mechanics of the script on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.1' | |
- name: Configure test repository | |
run: | | |
git clone https://github.com/xorcare/tornado | |
cd tornado | |
git config user.email "you@example.com" | |
git config user.name "Your Name" | |
- name: Test help flags | |
working-directory: tornado | |
run: | | |
../go-mod-bump.sh -h | |
../go-mod-bump.sh -help | |
../go-mod-bump.sh | |
- name: Test bump go version | |
working-directory: tornado | |
run: | | |
git checkout dc67e0b4138c3487d3b4d5f012b6a3262d2db25e | |
../go-mod-bump.sh go | |
commit_count=$(git rev-list --count HEAD ^dc67e0b4138c3487d3b4d5f012b6a3262d2db25e) | |
if [[ "$commit_count" == 0 ]]; then | |
echo "ERROR: No changes have been detected, but they must be exist" | |
exit 1 | |
fi | |
- name: Test bump modules version | |
working-directory: tornado | |
run: | | |
git checkout dc67e0b4138c3487d3b4d5f012b6a3262d2db25e | |
../go-mod-bump.sh all | |
commit_count=$(git rev-list --count HEAD ^dc67e0b4138c3487d3b4d5f012b6a3262d2db25e) | |
if [[ "$commit_count" == 0 ]]; then | |
echo "ERROR: No changes have been detected, but they must be exist" | |
exit 1 | |
fi |