Skip to content

Commit fb6e9e6

Browse files
committed
feat(ci): run backend on ci side
1 parent 1c8ceb3 commit fb6e9e6

File tree

6 files changed

+108
-366
lines changed

6 files changed

+108
-366
lines changed

.github/workflows/e2e.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,30 @@ jobs:
99
timeout-minutes: 60
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Check out backend
13+
uses: actions/checkout@v4
14+
with:
15+
repository: brocoders/nestjs-boilerplate
16+
# Use token for private repository
17+
# token: ${{ secrets.CI_PAT }}
18+
path: backend
19+
- run: cd backend && cp env-example-document .env
20+
- run: cd backend && sed -i 's/APP_PORT=3000/APP_PORT=3001/g' .env
21+
- run: cd backend && sed -i 's/BACKEND_DOMAIN=http:\/\/localhost:3000/BACKEND_DOMAIN=http:\/\/localhost:3001/g' .env
22+
- name: Run backend
23+
# print output of the command to file and store it as artifact
24+
run: cd backend && docker compose -f docker-compose.document.yaml up > ${{ runner.temp }}/backend.log 2>&1 &
25+
- run: cd backend && sed -i 's/\r//g' wait-for-it.sh
26+
- run: cd backend && ./wait-for-it.sh localhost:3001 -- echo "Backend is up"
27+
1228
- uses: actions/checkout@v4
1329
- uses: actions/setup-node@v4
1430
with:
15-
node-version: 18
31+
node-version: 22
1632
- name: Install dependencies
1733
run: npm ci
34+
- name: Run lint
35+
run: npm run lint
1836
- name: Install Playwright Browsers
1937
run: npx playwright install --with-deps
2038
- name: Run Playwright tests
@@ -24,4 +42,10 @@ jobs:
2442
with:
2543
name: playwright-report
2644
path: playwright-report/
45+
retention-days: 30
46+
- uses: actions/upload-artifact@v4
47+
if: ${{ !cancelled() }}
48+
with:
49+
name: backend-log
50+
path: ${{ runner.temp }}/backend.log
2751
retention-days: 30

example.env.local

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
NEXT_PUBLIC_API_URL=https://nestjs-boilerplate-test.herokuapp.com/api
1+
# If you don't want to run the backend locally, just replace
2+
# http://localhost:3001/api with https://nestjs-boilerplate-test.herokuapp.com/api
3+
NEXT_PUBLIC_API_URL=http://localhost:3001/api
24

35
NEXT_PUBLIC_IS_GOOGLE_AUTH_ENABLED=true
46
NEXT_PUBLIC_GOOGLE_CLIENT_ID=778828327699-3hu034kj1u76k4o5qla8221ovtbgl2g0.apps.googleusercontent.com
@@ -10,10 +12,3 @@ NEXT_PUBLIC_IS_SIGN_UP_ENABLED=true
1012

1113
# Support "local", "s3", "s3-presigned"
1214
NEXT_PUBLIC_FILE_DRIVER=local
13-
14-
# We store user and password in ENV for testing purposes only
15-
TEST_IMAP_USER=juwan.herzog61@ethereal.email
16-
TEST_IMAP_PASSWORD=SMSTVykf66Pw3NYPg6
17-
TEST_IMAP_HOST=imap.ethereal.email
18-
TEST_IMAP_PORT=993
19-
TEST_IMAP_TLS=true

0 commit comments

Comments
 (0)