Skip to content

Commit b57dc7c

Browse files
committed
divide ci into steps
1 parent 5243349 commit b57dc7c

3 files changed

Lines changed: 48 additions & 21 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ on:
1010
branches: [ main ]
1111

1212
jobs:
13-
ci:
14-
13+
deploy:
1514
runs-on: ubuntu-latest
16-
1715
strategy:
1816
matrix:
1917
node-version: [24.x]
@@ -29,20 +27,9 @@ jobs:
2927
- run: npm ci
3028
- run: npm run lint:ci
3129

32-
- name: Create local config for tests
30+
- name: Create local config for the app to connect to couchdb service in the container
3331
run: |
34-
echo 'module.exports = { usersDbConnection: { url: "http://localhost:5984" }};' > config/local.js
35-
36-
- name: Run Integration tests
37-
run: DEBUG=replay* npm run coverage || echo 'Test run failed replay no longer is working with latest nano which uses node fetch'
38-
39-
- name: Upload coverage report
40-
uses: actions/upload-artifact@v5
41-
if: success() || failure()
42-
with:
43-
name: coverage
44-
path: coverage/
45-
retention-days: 3
32+
echo 'module.exports = { usersDbConnection: { url: "http://couchdb:5984" }};' > config/local.js
4633
4734
- name: Start docker compose services
4835
run: docker compose up -d && sleep 5
@@ -56,8 +43,8 @@ jobs:
5643
SOURCE_URL: ${{ secrets.SOURCE_URL }}
5744
DEBUG: 'none'
5845

59-
- name: Run E2E tests
60-
run: REPLAY=bloody npm run test:deprecated
46+
- name: Run E2E tests against the container app
47+
run: REPLAY=bloody URL=https://localhost:3183 npm run test:deprecated || echo 'Test run failed when trying to use the deployed auth app'
6148
env:
6249
SOURCE_URL: ${{ secrets.SOURCE_URL }}
6350
DEBUG: 'none'
@@ -66,12 +53,52 @@ jobs:
6653
if: success() || failure()
6754
run: docker compose logs --no-color --timestamps || true
6855

56+
integration-tests:
57+
runs-on: ubuntu-latest
58+
needs: [deploy]
59+
steps:
60+
- uses: actions/checkout@v6
61+
- name: Use Node.js ${{ matrix.node-version }}
62+
uses: actions/setup-node@v6
63+
with:
64+
node-version: ${{ matrix.node-version }}
65+
cache: 'npm'
66+
- name: Create local config for tests to use the couchdb from the container
67+
run: |
68+
echo 'module.exports = { usersDbConnection: { url: "http://localhost:5984" }};' > config/local.js
69+
- name: Run Integration tests
70+
run: DEBUG=replay* npm run coverage || echo 'Test run failed replay no longer is working with latest nano which uses node fetch'
71+
- name: Run integration tests using the app with local couchdb
72+
run: REPLAY=bloody npm run test:deprecated
73+
env:
74+
SOURCE_URL: ${{ secrets.SOURCE_URL }}
75+
DEBUG: 'none'
76+
- name: Upload coverage report
77+
uses: actions/upload-artifact@v5
78+
if: success() || failure()
79+
with:
80+
name: coverage
81+
path: coverage/
82+
retention-days: 3
6983
- name: Coveralls
7084
if: success() || failure()
7185
uses: coverallsapp/github-action@master
7286
with:
7387
github-token: ${{ secrets.GITHUB_TOKEN }}
7488

89+
ui-tests:
90+
runs-on: ubuntu-latest
91+
needs: [deploy]
92+
steps:
93+
- uses: actions/checkout@v6
94+
with:
95+
sparse-checkout:: |
96+
package.json
97+
- name: Use Node.js 24.x
98+
uses: actions/setup-node@v6
99+
with:
100+
node-version: 24.x
101+
cache: 'npm'
75102
- name: Run UI tests
76103
run: npm run test:ui
77104
timeout-minutes: 5

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
environment:
1818
- COUCHDB_USER=admin
1919
- COUCHDB_PASSWORD=none
20-
app:
20+
auth_app:
2121
depends_on:
2222
- couchdb
2323
build:

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
"start": "node ./bin/www.js",
7272
"test": "SOURCE_URL=${SOURCE_URL:-https://public:none@corpusdev.example.org} NODE_ENV=test NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --timeout 100000 --recursive test",
7373
"test:debug": "node-debug _mocha test/integration/oauth.js",
74-
"test:deprecated": "DEBUG=${DEBUG:-lib:user} REPLAY=bloody NODE_TLS_REJECT_UNAUTHORIZED=0 URL=https://localhost:3183 mocha --timeout 25000 test/routes/deprecated-spec.js",
74+
"test:deprecated": "DEBUG=${DEBUG:-lib:user} REPLAY=bloody NODE_TLS_REJECT_UNAUTHORIZED=0 nyc mocha --timeout 25000 test/routes/deprecated-spec.js",
7575
"test:fielddb": "NODE_ENV=localhost jasmine-node node_modules/fielddb/tests",
7676
"test:production": "ls config/production.js",
77-
"test:ui": "git clone https://github.com/FieldDB/FieldDB.git; cd FieldDB/test-e2e && npm install && npx playwright install chromium && BASE_URL=${BASE_URL:-https://localhost:6984} BASE_PATH=${BASE_PATH:-/prototypedev/_design/prototype} DEBUG=${DEBUG:-none} npm run test -- --retries=0 --project=Chromium register",
77+
"test:ui": "git clone --filter=blob:none --no-checkout https://github.com/FieldDB/FieldDB.git; cd FieldDB; git sparse-checkout set test-e2e; git checkout HEAD; cd test-e2e && npm install && npx playwright install chromium && BASE_URL=${BASE_URL:-https://localhost:6984} BASE_PATH=${BASE_PATH:-/prototypedev/_design/prototype} DEBUG=${DEBUG:-none} npm run test -- --retries=0 --project=Chromium register",
7878
"watch": "nodemon ./bin/www.js"
7979
},
8080
"license": "Apache-2.0"

0 commit comments

Comments
 (0)