From c5aef4c3791dbc1317cae3112b8c0b2381ded541 Mon Sep 17 00:00:00 2001 From: Jeff Flater Date: Sat, 3 May 2025 10:51:57 -0500 Subject: [PATCH 1/3] test --- .github/workflows/behave.api.test.yml | 30 ++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/behave.api.test.yml b/.github/workflows/behave.api.test.yml index 912be02..2f07255 100644 --- a/.github/workflows/behave.api.test.yml +++ b/.github/workflows/behave.api.test.yml @@ -64,4 +64,32 @@ jobs: uses: actions/upload-artifact@v4 with: name: behave-junit-report - path: reports/ \ No newline at end of file + 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/ \ No newline at end of file From 8e28619eb03823308261c730e6cdb723233a3a8a Mon Sep 17 00:00:00 2001 From: Jeff Flater Date: Sun, 4 May 2025 12:05:18 -0500 Subject: [PATCH 2/3] enforce --- .github/workflows/enforce-develop-pr.yml | 16 ++++++++++++++++ .github/workflows/enforce-staging-pr.yml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/enforce-develop-pr.yml create mode 100644 .github/workflows/enforce-staging-pr.yml 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 From b19ac5df5307b59622f9a7c6d98b16d08821a020 Mon Sep 17 00:00:00 2001 From: Jeff Flater Date: Sun, 4 May 2025 12:07:08 -0500 Subject: [PATCH 3/3] fix --- .github/workflows/behave.api.test.yml | 49 +++++++++++++-------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/.github/workflows/behave.api.test.yml b/.github/workflows/behave.api.test.yml index 2f07255..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,28 +42,28 @@ 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/ + 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' @@ -92,4 +91,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: behave-junit-report - path: reports/ \ No newline at end of file + path: reports/