0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/.github/workflows/integration-test.yml
2023-03-05 22:07:02 +08:00

123 lines
3.1 KiB
YAML

name: Integration Test
on:
push:
branches:
- master
- "push-action/**"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v2
- name: Build
run: pnpm -r build
- name: Package
run: ./.scripts/package.sh
- uses: actions/upload-artifact@v3
with:
name: integration-test-${{ github.sha }}
path: /tmp/logto.tar.gz
retention-days: 3
run-logto:
needs: package
strategy:
matrix:
test_target: [api, ui, ui-cloud]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: tests
- name: Copy lockfile
run: |
cp tests/pnpm-lock.yaml ./
cp tests/package.json ./
- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v2
with:
run-install: false
# Setup integration test
- name: Install dependencies
run: |
cd tests
pnpm i
pnpm prepack
# Install Chromium
cd packages/integration-tests/node_modules/puppeteer
pnpm postinstall
# Setup environment
- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v4
- uses: actions/download-artifact@v3
with:
name: integration-test-${{ github.sha }}
- name: Extract
working-directory: tests
run: |
npm run cli init -- \
-p ../logto \
--db postgres://postgres:postgres@localhost:5432/postgres \
--du ../logto.tar.gz \
${{ contains(matrix.test_target, 'cloud') && '--cloud' || '' }}
- name: Check and add mock connectors
working-directory: tests
run: |
npm run cli connector list -- -p ../logto | grep OFFICIAL
npm run cli connector add @logto/connector-mock-sms @logto/connector-mock-email @logto/connector-mock-standard-email @logto/connector-mock-social -- -p ../logto
- name: Run Logto
working-directory: logto/
run: nohup npm start > nohup.out 2> nohup.err < /dev/null &
env:
INTEGRATION_TEST: true
- name: Run Logto Cloud
working-directory: logto/
if: contains(matrix.test_target, 'cloud')
run: nohup npm start:cloud > nohup-cloud.out 2> nohup-cloud.err < /dev/null &
env:
INTEGRATION_TEST: true
- name: Sleep for 5 seconds
run: sleep 5
# Test
- name: Run tests
# continue-on-error: true # Uncomment this line to debug
run: |
cd tests/packages/integration-tests
pnpm build
pnpm test:${{ matrix.test_target }}
- name: Show logs
working-directory: logto/
run: cat nohup.out
- name: Show error logs
working-directory: logto/
run: cat nohup.err