diff --git a/.github/workflows/behave.api.test.yml b/.github/workflows/behave.api.test.yml index 912be02..febc424 100644 --- a/.github/workflows/behave.api.test.yml +++ b/.github/workflows/behave.api.test.yml @@ -5,9 +5,8 @@ on: branches: [develop] pull_request: branches: [develop] - workflow_dispatch: - pull_request: types: [closed] + workflow_dispatch: jobs: dev-tests: @@ -43,25 +42,53 @@ jobs: runs-on: ubuntu-latest environment: STAGING - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Build Docker Image for Behave Tests - run: docker build -t behave-test . - - - name: Run Behave Tests in Docker - run: | - mkdir -p reports - docker run --rm \ - -e ANKRETH_API_KEY="${{ secrets.ANKRETH_API_KEY }}" \ - -e FINNHUB_API_KEY="${{ secrets.FINNHUB_API_KEY }}" \ - -v ${{ github.workspace }}/reports:/app/reports \ - behave-test test/features --junit --junit-directory /app/reports - continue-on-error: true - - - name: Upload Test Results (JUnit) - uses: actions/upload-artifact@v4 - with: - name: behave-junit-report - path: reports/ \ No newline at end of file + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Build Docker Image for Behave Tests + run: docker build -t behave-test . + + - name: Run Behave Tests in Docker + run: | + mkdir -p reports + docker run --rm \ + -e ANKRETH_API_KEY="${{ secrets.ANKRETH_API_KEY }}" \ + -e FINNHUB_API_KEY="${{ secrets.FINNHUB_API_KEY }}" \ + -v ${{ github.workspace }}/reports:/app/reports \ + behave-test test/features --junit --junit-directory /app/reports + continue-on-error: true + + - name: Upload Test Results (JUnit) + uses: actions/upload-artifact@v4 + with: + name: behave-junit-report + path: reports/ + + prod-tests: + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' + runs-on: ubuntu-latest + environment: PROD + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Build Docker Image for Behave Tests + run: docker build -t behave-test . + + - name: Run Behave Tests in Docker + run: | + mkdir -p reports + docker run --rm \ + -e ANKRETH_API_KEY="${{ secrets.ANKRETH_API_KEY }}" \ + -e FINNHUB_API_KEY="${{ secrets.FINNHUB_API_KEY }}" \ + -v ${{ github.workspace }}/reports:/app/reports \ + behave-test test/features --junit --junit-directory /app/reports + continue-on-error: true + + - name: Upload Test Results (JUnit) + uses: actions/upload-artifact@v4 + with: + name: behave-junit-report + path: reports/ diff --git a/.github/workflows/enforce-develop-pr.yml b/.github/workflows/enforce-develop-pr.yml new file mode 100644 index 0000000..74d4ee7 --- /dev/null +++ b/.github/workflows/enforce-develop-pr.yml @@ -0,0 +1,16 @@ +name: Enforce PRs Only from Develop + +on: + pull_request: + branches: [staging] + +jobs: + check-develop-only: + runs-on: ubuntu-latest + steps: + - name: Fail if source is not develop + run: | + if [[ "${{ github.head_ref }}" != "develop" ]]; then + echo "Only PRs from 'develop' branch are allowed to merge into 'staging'." + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/enforce-staging-pr.yml b/.github/workflows/enforce-staging-pr.yml new file mode 100644 index 0000000..337229b --- /dev/null +++ b/.github/workflows/enforce-staging-pr.yml @@ -0,0 +1,16 @@ +name: Enforce PRs Only from Staging + +on: + pull_request: + branches: [main] + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Fail if source is not staging + run: | + if [[ "${{ github.head_ref }}" != "staging" ]]; then + echo "Only PRs from 'staging' branch are allowed to merge into 'main'." + exit 1 + fi \ No newline at end of file