Skip to content

Commit 6939371

Browse files
Modify CI/CD workflow for self-hosted runner
Updated CI/CD workflow to use self-hosted runner and removed SSH tunnel setup.
1 parent 1461747 commit 6939371

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88

99
jobs:
1010
build-and-test:
11-
runs-on: ubuntu-latest
11+
# Run on self-hosted runner inside the VPC
12+
runs-on: [self-hosted, linux]
1213
steps:
1314
- name: Checkout code
1415
uses: actions/checkout@v3
@@ -21,25 +22,13 @@ jobs:
2122
- name: Install dependencies
2223
run: npm install
2324

24-
- name: Set up SSH key
25-
run: |
26-
echo "${{ secrets.EC2_KEY }}" > ec2_key.pem
27-
chmod 600 ec2_key.pem
28-
29-
- name: Start SSH tunnel to RDS
30-
run: |
31-
ssh -i ec2_key.pem -o StrictHostKeyChecking=no -N -L 5432:${{ secrets.DB_HOST }}:5432 ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} &
32-
echo "SSH tunnel started"
33-
34-
- name: Wait for tunnel
35-
run: sleep 5
36-
3725
- name: Run tests
3826
env:
39-
DB_HOST: localhost
27+
DB_HOST: ${{ secrets.DB_HOST }} # RDS private endpoint
4028
DB_USER: ${{ secrets.DB_USER }}
4129
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
4230
DB_NAME: ${{ secrets.DB_NAME }}
31+
DB_PORT: ${{ secrets.DB_PORT }}
4332
run: npm test || echo "Skipping tests temporarily"
4433

4534
deploy:

0 commit comments

Comments
 (0)