diff --git a/.github/workflows/sync-setup-script.yml b/.github/workflows/sync-setup-script.yml new file mode 100644 index 0000000..8aad3fe --- /dev/null +++ b/.github/workflows/sync-setup-script.yml @@ -0,0 +1,32 @@ +name: Sync Setup Script to GitHub Pages + +on: + push: + branches: + - main + paths: + - 'setup.sh' + workflow_dispatch: + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Checkout kagglelink repo + uses: actions/checkout@v4 + + - name: Create setup file (without .sh extension) + run: cp setup.sh setup + + - name: Push setup to GitHub Pages repo + uses: dmnemec/copy_file_to_another_repo_action@main + env: + API_TOKEN_GITHUB: ${{ secrets.PAGES_DEPLOY_TOKEN }} + with: + source_file: 'setup' + destination_repo: 'bhdai/bhdai.github.io' + destination_folder: '' + destination_branch: 'master' + user_email: 'github-actions[bot]@users.noreply.github.com' + user_name: 'github-actions[bot]' + commit_message: 'Sync setup script from kagglelink repo' diff --git a/tests/unit/test_argument_parsing.bats b/tests/unit/test_argument_parsing.bats index 35fc25d..91a7cc1 100644 --- a/tests/unit/test_argument_parsing.bats +++ b/tests/unit/test_argument_parsing.bats @@ -88,6 +88,46 @@ teardown() { [[ "$output" == *"Usage"* ]] || [[ "$output" == *"-k"* ]] || [[ "$output" == *"help"* ]] } +# ============================================================================= +# Exit Code Tests (AC1, AC3) +# ============================================================================= + +@test "P0: help flag (-h) should exit with code 0" { + run bash setup.sh -h + [ "$status" -eq 0 ] + [[ "$output" == *"Usage"* ]] +} + +@test "P0: help flag (--help) should exit with code 0" { + run bash setup.sh --help + [ "$status" -eq 0 ] + [[ "$output" == *"Usage"* ]] +} + +@test "P0: unknown option should exit with code 1" { + run bash setup.sh --invalid-flag + [ "$status" -eq 1 ] + [[ "$output" == *"Unknown option"* ]] +} + +@test "P0: missing required arguments should exit with code 1" { + run bash setup.sh -k "https://example.com/keys" + [ "$status" -eq 1 ] +} + +@test "P0: unknown option should display specific error message" { + run bash setup.sh -x value + [ "$status" -eq 1 ] + [[ "$output" == *"Unknown option: -x"* ]] +} + +@test "P1: usage message should include branch variable" { + run bash setup.sh -h + [ "$status" -eq 0 ] + # Should show branch in usage (via KAGGLELINK_BRANCH variable) + [[ "$output" == *"BRANCH"* ]] || [[ "$output" == *"main"* ]] +} + # ============================================================================= # URL Validation Tests (Future - when URL validation is implemented) # =============================================================================