2022-05-10 02:29:53 -05:00
|
|
|
name: Integration Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-07-01 07:33:08 -05:00
|
|
|
branches:
|
|
|
|
- master
|
2022-09-05 04:49:11 -05:00
|
|
|
- "push-action/**"
|
2022-06-27 03:38:39 -05:00
|
|
|
pull_request:
|
2022-06-17 10:58:29 -05:00
|
|
|
|
2022-07-26 03:12:34 -05:00
|
|
|
concurrency:
|
2023-01-18 22:22:17 -05:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
2022-06-17 10:58:29 -05:00
|
|
|
cancel-in-progress: true
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
package:
|
2023-03-05 11:48:50 -05:00
|
|
|
# See https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
env: [oss, cloud]
|
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2022-10-15 11:49:16 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v2
|
2022-05-10 02:29:53 -05:00
|
|
|
|
2023-03-06 00:45:14 -05:00
|
|
|
- name: Build and package
|
2023-03-05 11:48:50 -05:00
|
|
|
if: matrix.env != 'cloud'
|
2023-03-06 00:45:14 -05:00
|
|
|
run: |
|
|
|
|
pnpm -r build
|
|
|
|
./.scripts/package.sh
|
2023-03-05 11:48:50 -05:00
|
|
|
|
2023-03-06 00:45:14 -05:00
|
|
|
- name: Build and package (Cloud)
|
2023-03-05 11:48:50 -05:00
|
|
|
if: matrix.env == 'cloud'
|
2023-03-06 00:45:14 -05:00
|
|
|
run: |
|
|
|
|
pnpm -r build
|
|
|
|
./.scripts/package.sh
|
2023-03-05 11:48:50 -05:00
|
|
|
env:
|
|
|
|
IS_CLOUD: 1
|
|
|
|
CONSOLE_PUBLIC_URL: /
|
2023-03-06 00:45:14 -05:00
|
|
|
ADMIN_ENDPOINT: http://localhost:3002
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-03-05 11:48:50 -05:00
|
|
|
name: integration-test-${{ github.sha }}-${{ matrix.env }}
|
2022-05-10 02:29:53 -05:00
|
|
|
path: /tmp/logto.tar.gz
|
|
|
|
retention-days: 3
|
2022-07-26 03:12:34 -05:00
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
run-logto:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-03-05 11:48:50 -05:00
|
|
|
target: [api, ui, ui-cloud]
|
2022-07-26 03:12:34 -05:00
|
|
|
|
2023-03-05 11:48:50 -05:00
|
|
|
needs: package
|
2022-11-07 10:11:21 -05:00
|
|
|
runs-on: ubuntu-latest
|
2023-03-05 11:48:50 -05:00
|
|
|
env:
|
|
|
|
INTEGRATION_TEST: true
|
|
|
|
IS_CLOUD: ${{ contains(matrix.target, 'cloud') && '1' || '0' }}
|
2023-03-13 00:58:58 -05:00
|
|
|
PATH_BASED_MULTI_TENANCY: ${{ contains(matrix.target, 'cloud') && '1' || '0' }}
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
steps:
|
2022-05-17 03:59:57 -05:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
2022-07-19 09:02:08 -05:00
|
|
|
path: tests
|
2022-05-17 03:59:57 -05:00
|
|
|
|
2022-07-19 09:02:08 -05:00
|
|
|
- name: Copy lockfile
|
|
|
|
run: |
|
|
|
|
cp tests/pnpm-lock.yaml ./
|
|
|
|
cp tests/package.json ./
|
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2022-10-15 11:49:16 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v2
|
2022-05-10 02:29:53 -05:00
|
|
|
with:
|
2022-07-19 09:02:08 -05:00
|
|
|
run-install: false
|
2022-05-10 02:29:53 -05:00
|
|
|
|
2022-07-19 09:02:08 -05:00
|
|
|
# Setup integration test
|
2022-05-17 03:59:57 -05:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2022-10-15 11:49:16 -05:00
|
|
|
cd tests
|
2022-07-19 09:02:08 -05:00
|
|
|
pnpm i
|
2022-07-20 01:21:13 -05:00
|
|
|
pnpm prepack
|
2022-11-07 10:11:21 -05:00
|
|
|
# Install Chromium
|
|
|
|
cd packages/integration-tests/node_modules/puppeteer
|
|
|
|
pnpm postinstall
|
2022-05-17 03:59:57 -05:00
|
|
|
|
|
|
|
# Setup environment
|
2022-09-01 00:54:40 -05:00
|
|
|
- name: Setup Postgres
|
2023-01-04 01:09:10 -05:00
|
|
|
uses: ikalnytskyi/action-setup-postgres@v4
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
2023-03-05 11:48:50 -05:00
|
|
|
name: integration-test-${{ github.sha }}-${{ contains(matrix.target, 'cloud') && 'cloud' || 'oss' }}
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
- name: Extract
|
2022-10-15 11:49:16 -05:00
|
|
|
working-directory: tests
|
|
|
|
run: |
|
2023-03-05 09:07:02 -05:00
|
|
|
npm run cli init -- \
|
|
|
|
-p ../logto \
|
|
|
|
--db postgres://postgres:postgres@localhost:5432/postgres \
|
|
|
|
--du ../logto.tar.gz \
|
2023-03-05 11:48:50 -05:00
|
|
|
${{ contains(matrix.target, 'cloud') && '--cloud' || '' }}
|
2022-10-15 11:49:16 -05:00
|
|
|
|
2022-12-29 21:42:34 -05:00
|
|
|
- name: Check and add mock connectors
|
2022-10-15 11:49:16 -05:00
|
|
|
working-directory: tests
|
|
|
|
run: |
|
2022-12-29 21:42:34 -05:00
|
|
|
npm run cli connector list -- -p ../logto | grep OFFICIAL
|
2022-12-06 04:04:57 -05:00
|
|
|
npm run cli connector add @logto/connector-mock-sms @logto/connector-mock-email @logto/connector-mock-standard-email @logto/connector-mock-social -- -p ../logto
|
2022-10-08 04:12:19 -05:00
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
- name: Run Logto
|
2022-10-19 02:38:56 -05:00
|
|
|
working-directory: logto/
|
2023-02-09 05:31:14 -05:00
|
|
|
run: nohup npm start > nohup.out 2> nohup.err < /dev/null &
|
2022-05-10 02:29:53 -05:00
|
|
|
|
2023-03-05 09:07:02 -05:00
|
|
|
- name: Run Logto Cloud
|
|
|
|
working-directory: logto/
|
2023-03-05 11:48:50 -05:00
|
|
|
if: contains(matrix.target, 'cloud')
|
|
|
|
run: nohup npm run start:cloud > nohup-cloud.out 2> nohup-cloud.err < /dev/null &
|
2023-03-05 09:07:02 -05:00
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
- name: Sleep for 5 seconds
|
|
|
|
run: sleep 5
|
|
|
|
|
2022-05-17 03:59:57 -05:00
|
|
|
# Test
|
|
|
|
- name: Run tests
|
2023-02-21 08:24:43 -05:00
|
|
|
# continue-on-error: true # Uncomment this line to debug
|
2022-05-17 03:59:57 -05:00
|
|
|
run: |
|
2022-10-15 11:49:16 -05:00
|
|
|
cd tests/packages/integration-tests
|
2022-12-22 00:03:12 -05:00
|
|
|
pnpm build
|
2023-03-05 11:48:50 -05:00
|
|
|
pnpm run test:${{ matrix.target }}
|
2023-02-09 05:31:14 -05:00
|
|
|
|
|
|
|
- name: Show logs
|
|
|
|
working-directory: logto/
|
|
|
|
run: cat nohup.out
|
|
|
|
|
|
|
|
- name: Show error logs
|
|
|
|
working-directory: logto/
|
|
|
|
run: cat nohup.err
|
2023-03-05 11:48:50 -05:00
|
|
|
|
|
|
|
- name: Show cloud logs
|
|
|
|
working-directory: logto/
|
|
|
|
if: contains(matrix.target, 'cloud')
|
|
|
|
run: cat nohup-cloud.out
|
|
|
|
|
|
|
|
- name: Show cloud error logs
|
|
|
|
working-directory: logto/
|
|
|
|
if: contains(matrix.target, 'cloud')
|
|
|
|
run: cat nohup-cloud.err
|