diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a735918..3fcfef2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,3 +87,80 @@ jobs: - name: Build run: go build -v ./... + + integration-test: + name: Integration Test + runs-on: ubuntu-latest + needs: [build] + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + + - name: Build binary + run: go build -o raptor ./cmd/raptor + + - name: Test - No arguments (shows help) + run: | + OUTPUT=$(./raptor 2>&1) || true + echo "$OUTPUT" + echo "$OUTPUT" | grep -q "Usage: raptor" + + - name: Test - help command + run: | + ./raptor help | grep -q "Usage: raptor" + + - name: Test - -h flag + run: | + ./raptor -h | grep -q "Usage: raptor" + + - name: Test - --help flag + run: | + ./raptor --help | grep -q "Usage: raptor" + + - name: Test - version command + run: | + ./raptor version | grep -q "raptor" + + - name: Test - -v flag + run: | + ./raptor -v | grep -q "raptor" + + - name: Test - --version flag + run: | + ./raptor --version | grep -q "raptor" + + - name: Test - unknown command (should fail) + run: | + if ./raptor unknown-command 2>&1; then + echo "Expected failure but got success" + exit 1 + fi + ./raptor unknown-command 2>&1 | grep -q "unknown command" + + - name: Test - dry-run mode (without run command) + run: | + ./raptor -w testdata/workflows/simple.yml 2>&1 | grep -q -E "(dry-run|Dry-run|DRY)" + + - name: Test - run with dry-run flag + run: | + ./raptor run -w testdata/workflows/simple.yml -n 2>&1 + + - name: Test - run with --dry-run flag + run: | + ./raptor run -w testdata/workflows/simple.yml --dry-run 2>&1 + + - name: Test - run specific job with dry-run + run: | + ./raptor run -w testdata/workflows/multi-job.yml -j build -n 2>&1 + + - name: Test - missing workflow flag (should fail) + run: | + if ./raptor run 2>&1; then + echo "Expected failure but got success" + exit 1 + fi + ./raptor run 2>&1 | grep -q -E "(workflow|required)" diff --git a/.gitignore b/.gitignore index e460844..752d2a7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # # Binaries for programs and plugins bin/ +raptor *.exe *.exe~ *.dll diff --git a/testdata/workflows/multi-job.yml b/testdata/workflows/multi-job.yml new file mode 100644 index 0000000..11fd337 --- /dev/null +++ b/testdata/workflows/multi-job.yml @@ -0,0 +1,26 @@ +name: Multi Job Workflow + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Build step + run: echo "Building..." + + test: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Test step + run: echo "Testing..." + + deploy: + runs-on: ubuntu-latest + needs: [test] + steps: + - name: Deploy step + run: echo "Deploying..." diff --git a/testdata/workflows/simple.yml b/testdata/workflows/simple.yml new file mode 100644 index 0000000..ab08bed --- /dev/null +++ b/testdata/workflows/simple.yml @@ -0,0 +1,15 @@ +name: Simple Test Workflow + +on: + push: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Echo hello + run: echo "Hello, World!" + + - name: Show date + run: date