2022-05-10 15:29:53 +08:00
|
|
|
name: Integration Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-07-01 20:33:08 +08:00
|
|
|
branches:
|
|
|
|
- master
|
2022-09-05 17:49:11 +08:00
|
|
|
- "push-action/**"
|
2022-06-27 16:38:39 +08:00
|
|
|
pull_request:
|
2022-06-17 23:58:29 +08:00
|
|
|
|
2022-07-26 16:12:34 +08:00
|
|
|
concurrency:
|
2022-07-01 21:33:25 +08:00
|
|
|
group: integration-test-${{ github.head_ref || github.run_id }}
|
2022-06-17 23:58:29 +08:00
|
|
|
cancel-in-progress: true
|
2022-05-10 15:29:53 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
package:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2022-10-16 00:49:16 +08:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v2
|
2022-05-10 15:29:53 +08:00
|
|
|
|
2022-09-05 17:49:11 +08:00
|
|
|
- name: Build
|
2022-10-17 19:37:59 +08:00
|
|
|
run: pnpm -r build
|
2022-09-05 17:49:11 +08:00
|
|
|
|
2022-08-09 11:23:05 +08:00
|
|
|
- name: Package
|
|
|
|
run: ./package.sh
|
2022-05-10 15:29:53 +08:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: integration-test-${{ github.sha }}
|
|
|
|
path: /tmp/logto.tar.gz
|
|
|
|
retention-days: 3
|
2022-07-26 16:12:34 +08:00
|
|
|
|
2022-05-10 15:29:53 +08:00
|
|
|
run-logto:
|
|
|
|
needs: package
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-06 00:29:28 +08:00
|
|
|
node_version: [16, 18]
|
2022-07-26 16:12:34 +08:00
|
|
|
|
2022-11-07 23:11:21 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-10 15:29:53 +08:00
|
|
|
|
|
|
|
steps:
|
2022-05-17 16:59:57 +08:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
2022-07-19 22:02:08 +08:00
|
|
|
path: tests
|
2022-05-17 16:59:57 +08:00
|
|
|
|
2022-07-19 22:02:08 +08:00
|
|
|
- name: Copy lockfile
|
|
|
|
run: |
|
|
|
|
cp tests/pnpm-lock.yaml ./
|
|
|
|
cp tests/package.json ./
|
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2022-10-16 00:49:16 +08:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v2
|
2022-05-10 15:29:53 +08:00
|
|
|
with:
|
2022-11-06 00:29:28 +08:00
|
|
|
node-version: ${{ matrix.node_version }}
|
2022-07-19 22:02:08 +08:00
|
|
|
run-install: false
|
2022-05-10 15:29:53 +08:00
|
|
|
|
2022-07-19 22:02:08 +08:00
|
|
|
# Setup integration test
|
2022-05-17 16:59:57 +08:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2022-10-16 00:49:16 +08:00
|
|
|
cd tests
|
2022-07-19 22:02:08 +08:00
|
|
|
pnpm i
|
2022-07-20 14:21:13 +08:00
|
|
|
pnpm prepack
|
2022-11-07 23:11:21 +08:00
|
|
|
# Install Chromium
|
|
|
|
cd packages/integration-tests/node_modules/puppeteer
|
|
|
|
pnpm postinstall
|
2022-05-17 16:59:57 +08:00
|
|
|
|
|
|
|
# Setup environment
|
2022-09-01 13:54:40 +08:00
|
|
|
- name: Setup Postgres
|
|
|
|
uses: ikalnytskyi/action-setup-postgres@v3
|
2022-05-10 15:29:53 +08:00
|
|
|
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: integration-test-${{ github.sha }}
|
|
|
|
|
|
|
|
- name: Extract
|
2022-10-16 00:49:16 +08:00
|
|
|
working-directory: tests
|
|
|
|
run: |
|
2022-10-19 15:38:56 +08:00
|
|
|
npm run cli init -- -p ../logto --db postgres://postgres:postgres@localhost:5432/postgres --no-oc --du ../logto.tar.gz
|
2022-10-16 00:49:16 +08:00
|
|
|
|
|
|
|
- name: Add mock connectors
|
|
|
|
working-directory: tests
|
|
|
|
run: |
|
|
|
|
npm run cli connector add @logto/connector-mock-sms @logto/connector-mock-email @logto/connector-mock-social -- -p ../logto
|
2022-10-08 17:12:19 +08:00
|
|
|
|
2022-05-10 15:29:53 +08:00
|
|
|
- name: Run Logto
|
2022-10-19 15:38:56 +08:00
|
|
|
working-directory: logto/
|
|
|
|
run: npm start &
|
2022-05-10 15:29:53 +08:00
|
|
|
env:
|
2022-07-20 14:21:13 +08:00
|
|
|
INTEGRATION_TEST: true
|
2022-05-10 15:29:53 +08:00
|
|
|
|
|
|
|
- name: Sleep for 5 seconds
|
|
|
|
run: sleep 5
|
|
|
|
|
2022-05-17 16:59:57 +08:00
|
|
|
# Test
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
2022-10-16 00:49:16 +08:00
|
|
|
cd tests/packages/integration-tests
|
2022-07-19 22:02:08 +08:00
|
|
|
pnpm start
|
2022-05-17 16:59:57 +08:00
|
|
|
env:
|
2022-08-12 18:07:16 +08:00
|
|
|
INTEGRATION_TESTS_LOGTO_URL: http://localhost:3001
|