Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions .github/workflows/behave.api.test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
name: Behave API Test

on:
push:
branches: [develop] # Runs dev-tests
# PRs into develop or main (for dev/staging test runs)
pull_request:
branches: [main] # Triggers on PRs *into* main (used for staging-tests)
workflow_dispatch:
branches: [develop, main]
types: [opened, synchronize, reopened, ready_for_review]
# Fire after PR is closed (for prod test run when merged)
pull_request_target:
types: [closed] # Used for prod-tests (PR merged to main)
types: [closed]
# Manual run
workflow_dispatch:

jobs:
# -------------------------
# DEV: PRs into develop
# -------------------------
dev-tests:
if: github.ref == 'refs/heads/develop'
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.base.ref == 'develop' &&
!github.event.pull_request.draft
runs-on: ubuntu-latest
environment: DEV

Expand All @@ -38,8 +46,15 @@ jobs:
name: behave-junit-report
path: reports/

# -------------------------
# STAGING: PRs into main from staging branch
# -------------------------
staging-tests:
if: github.event.pull_request.head.ref == 'staging' && github.event.pull_request.base.ref == 'main' && !github.event.pull_request.merged
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.base.ref == 'main' &&
github.event.pull_request.head.ref == 'staging' &&
!github.event.pull_request.draft
runs-on: ubuntu-latest
environment: STAGING

Expand All @@ -66,8 +81,14 @@ jobs:
name: behave-junit-report
path: reports/

# -------------------------
# PROD: when PR into main is merged
# -------------------------
prod-tests:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
if: >
github.event_name == 'pull_request_target' &&
github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
environment: PROD

Expand Down