Skip to content

Commit 3899dd4

Browse files
authored
Merge pull request #1423 from ponmileleke54-dev/#1252
fix: remove duplicate CI runs in PR gate
2 parents 5262b18 + b9aaccf commit 3899dd4

1 file changed

Lines changed: 23 additions & 57 deletions

File tree

.github/workflows/pr-test-gate.yml

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,39 @@
11
name: PR Test Gate
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
77

88
jobs:
99
contracts-test:
1010
name: Contracts cargo test
1111
runs-on: ubuntu-latest
12+
if: github.event.workflow_run.event == 'pull_request'
1213
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
15-
16-
- name: Setup Rust
17-
uses: dtolnay/rust-toolchain@stable
18-
with:
19-
targets: wasm32-unknown-unknown
20-
21-
- name: Run cargo test
22-
run: cargo test
23-
working-directory: contracts
14+
- name: Verify CI succeeded for the pull request
15+
env:
16+
CI_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
17+
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
18+
run: |
19+
if [ "$CI_CONCLUSION" != "success" ]; then
20+
echo "CI workflow failed for pull request #${PR_NUMBER}."
21+
exit 1
22+
fi
23+
echo "CI workflow succeeded for pull request #${PR_NUMBER}; no duplicate contract run is required."
2424
2525
backend-test:
2626
name: Backend npm test
2727
runs-on: ubuntu-latest
28-
services:
29-
postgres:
30-
# Pinned to match the version used in ci.yml and docker-compose.yml
31-
# (production target). Keep these in sync — see issue #1282.
32-
image: postgres:16-alpine@sha256:e013e867e712fec275706a6c51c966f0bb0c93cfa8f51000f85a15f9865a28cb
33-
env:
34-
POSTGRES_USER: postgres
35-
POSTGRES_PASSWORD: password
36-
POSTGRES_DB: flowfi_test
37-
ports:
38-
- 5432:5432
39-
options: >-
40-
--health-cmd "pg_isready -U postgres"
41-
--health-interval 10s
42-
--health-timeout 5s
43-
--health-retries 5
28+
if: github.event.workflow_run.event == 'pull_request'
4429
steps:
45-
- name: Checkout code
46-
uses: actions/checkout@v4
47-
48-
- name: Setup Node.js
49-
uses: actions/setup-node@v4
50-
with:
51-
node-version: "20"
52-
cache: "npm"
53-
cache-dependency-path: package-lock.json
54-
55-
- name: Install dependencies
56-
run: npm ci --include=optional
57-
58-
- name: Prepare database schema
59-
run: |
60-
npx prisma generate --schema=prisma/schema.prisma
61-
npx prisma db push --accept-data-loss --schema=prisma/schema.prisma
62-
working-directory: backend
30+
- name: Verify CI succeeded for the pull request
6331
env:
64-
DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/flowfi_test
65-
66-
- name: Run backend tests
32+
CI_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
33+
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
6734
run: |
68-
ls -la src/generated/prisma
69-
npm test --silent -- --reporter=basic
70-
working-directory: backend
71-
env:
72-
DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/flowfi_test
73-
NODE_ENV: test
35+
if [ "$CI_CONCLUSION" != "success" ]; then
36+
echo "CI workflow failed for pull request #${PR_NUMBER}."
37+
exit 1
38+
fi
39+
echo "CI workflow succeeded for pull request #${PR_NUMBER}; no duplicate backend run is required."

0 commit comments

Comments
 (0)